[Qt-interest] QTableView and spans
Stephen Kelly
steveire at gmail.com
Tue Aug 11 21:11:28 CEST 2009
Lars Amsel wrote:
> Hi,
>
> I want to use a table view with spans. The model behind is a list with
> transaction. Each transaction has several actions. I want to display all
> actions in that table. The first column should display the transaction
> itself.
>
> This should look like this (monospaced font)
>
> +----+---------------+
> | T1 | action a |
> +----+---------------+
> | | action x |
> | T2 | action y |
> | | action z |
> +----+---------------+
> | T3 | action z |
> +----+---------------+
>
> The spans works in Qt 4.5 I am using. What I don't like is, that I have to
> set the spans in the view component. I would rather implement this
> information on the model size (somehow), but there seems to be no support
> in Qt itself, neither in the QAbstractTableModel nor in the QTableView.
I haven't attempted to use it, but there is
QSize QAbstractItemModel::span ( const QModelIndex & index )
The documentation says it's currently unused, but that might be outdated I
guess. Presumably, if you say it works in the views, all you have to do is
implemement that to return a height of 3 for the Model::index(0, 1);
Or it could be still planned to make it useful in the future.
Steve
>
> Is it planned to support spans on the model side in future versions? Or is
> there a special trick I don't know to have such simple spans without
> writing a single line of code on the view side?
>
> regards
>
> Lars
More information about the Qt-interest-old
mailing list