[Qt-interest] Creating a QModelIndex outside of a QAbstractItemModel subclass

Dario Ahdoot dario.ahdoot at image-metrics.com
Thu Mar 12 19:18:20 CET 2009


Yes, it doesn't select the whole row. However, if a view's style is select the whole row, then selecting an index through the selection model of the view should be identical to selecting that index through the UI itself, no? i.e. the whole row of the index should be selected, I would think.

If you select an item in a tree view where the selection behavior is to select the whole row when you click on an item (or select it programmatically), it is weird to see the existing behavior, both from a coders and UI point of view.

D

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Andreas Pakulat
Sent: Thursday, March 12, 2009 9:09 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Creating a QModelIndex outside of a QAbstractItemModel subclass

On 12.03.09 10:36:05, Dario Ahdoot wrote:
> Thanks. I somehow missed that method on QAbstractItemModel.
> 
> On a related note, based on the code snippet below, would you consider it a bug that if you have a tree with a SelectionBehavior of QAbstractItemView::SelectRows, then when you call select on it, then it should select the whole row of the model index you pass in?

So you mean it doesn't select the whole row, right? Thats actually correct,
because you're selecting something in the selection model, not the view.
The selection behaviour is private to the view and only drives what the
user can select. For example its perfectly possible to have the same
selection model in two different views and one only allows to select full
rows, while the other allows to select single items (no I don't have a real
world use-case at hand right now).

Andreas

-- 
A few hours grace before the madness begins again.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list