1

QTableView から継承するコントロールを使用して表示するグリッドがあります。現在、グリッドは左から右に表示され、オーバーフローすると、このように次の行に移動します

 -----------
| 1 | 2 | 3 |
|------------
| 4 |   |   |
|------------
|   |   |   |
 -----------

しかし、最初に上から下に移動してから、オーバーフローすると、このように次の列に移動する必要があります

 -----------
| 1 | 4 |   |
|------------
| 2 |   |   |
|------------
| 3 |   |   |
 -----------

私は主に .Net 開発者であり、.net winforms コントロールを使用するのはかなり簡単ですが、どうすればQTableViewこれを行うことができますか?

ありがとう

4

1 に答える 1

3

The data displayed is a function of your model. The best way to change the behavior is to create a proxy QAbstractTableModel that swaps the rows and the columns. How complicated this will be will be dependent on your current model. It almost sounds like you have a linear model and that the view just presents it in a table-like fashion in which case you're probably using the wrong model.

If you really do have a linear model, consider using QAbstractListModel and QListView. The QListView then has a flow property that will allow you to choose between left-to-right and top-to-bottom.

于 2011-10-11T19:01:00.107 に答える