Qt-interest Archive, April 2007
current index vs. selection
Message 1 in thread
Hi,
I use a custom model which implements #flags so that only certain
indexes are selectable (Qt::ItemIsSelectable). This model is set on a
tree view, and the custom flags method seems to work: only certain items
can be selected, others are still set "current" when clicked.
Now I assumed the #selectionChanged signal from the view's selection
model would only be emitted for indexes with the ItemIsSelectable flag,
but I also get it for indexes which are only set "current". Is this the
expected behaviour?
Thanks!
M
--
[ signature omitted ]
Message 2 in thread
> I use a custom model which implements #flags so that only certain
> indexes are selectable (Qt::ItemIsSelectable). This model is set on a
> tree view, and the custom flags method seems to work: only certain items
> can be selected, others are still set "current" when clicked.
>
> Now I assumed the #selectionChanged signal from the view's selection
> model would only be emitted for indexes with the ItemIsSelectable flag,
> but I also get it for indexes which are only set "current". Is this the
> expected behaviour?
Can nobody help me with this, not even the model/view elite? This would
really help me understand the framework better...
--
[ signature omitted ]
Message 3 in thread
I had hit this previously, and I thought I filed a bug, but it wouldn't
surprise me if I didn't...
What I found, is the signal is emitted before the check for is
selectable.. (I hit this bug on a QT 4.1 based codebase... so it could
be changed since)
What I wound up doing...
On my "selection changed" slot, check the flags via index.flags() and
validated it was selectable. Even when it got called erroneously, it
didn't hurt then.
Scott
> -----Original Message-----
> From: QMartin [mailto:martin.umgeher@xxxxxxxxxxx]
> Sent: Tuesday, April 10, 2007 12:51 AM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Re: current index vs. selection
>
> > I use a custom model which implements #flags so that only certain
> > indexes are selectable (Qt::ItemIsSelectable). This model is set on
a
> > tree view, and the custom flags method seems to work: only certain
items
> > can be selected, others are still set "current" when clicked.
> >
> > Now I assumed the #selectionChanged signal from the view's selection
> > model would only be emitted for indexes with the ItemIsSelectable
flag,
> > but I also get it for indexes which are only set "current". Is this
the
> > expected behaviour?
>
>
> Can nobody help me with this, not even the model/view elite? This
would
> really help me understand the framework better...
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 4 in thread
> I had hit this previously, and I thought I filed a bug, but it wouldn't
> surprise me if I didn't...
>
> What I found, is the signal is emitted before the check for is
> selectable.. (I hit this bug on a QT 4.1 based codebase... so it could
> be changed since)
>
> What I wound up doing...
>
> On my "selection changed" slot, check the flags via index.flags() and
> validated it was selectable. Even when it got called erroneously, it
> didn't hurt then.
>
> Scott
Arrgh... you probably did file this bug, at least it works properly in
4.2.3. I connected to the wrong signal (currentChanged). Sorry for all
the confusion...
thx!
M
>> -----Original Message-----
>> From: QMartin [mailto:martin.umgeher@xxxxxxxxxxx]
>> Sent: Tuesday, April 10, 2007 12:51 AM
>> To: qt-interest@xxxxxxxxxxxxx
>> Subject: Re: current index vs. selection
>>
>>> I use a custom model which implements #flags so that only certain
>>> indexes are selectable (Qt::ItemIsSelectable). This model is set on
> a
>>> tree view, and the custom flags method seems to work: only certain
> items
>>> can be selected, others are still set "current" when clicked.
>>>
>>> Now I assumed the #selectionChanged signal from the view's selection
>>> model would only be emitted for indexes with the ItemIsSelectable
> flag,
>>> but I also get it for indexes which are only set "current". Is this
> the
>>> expected behaviour?
>>
>> Can nobody help me with this, not even the model/view elite? This
> would
>> really help me understand the framework better...
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]