Qt-interest Archive, May 2007
where to put change of state of persistent editors for multirow operation
Message 1 in thread
Dear Experts,
could someone tell where/how is the best place to do following:
i have qlistview item, first column contains only checkbox persistent
editors. The list view has extended selectability. What I'd like to do is
if I select multiple rows and then check the checkbox of one of the rows
selected, i'd like to check/uncheck the checkboxes of all rows which are
selected..
and now the question is where to put this code....
if i put it into delegate (setmodeldata), then i'm not able to get the
information about what checkbox is assigned to what modelindex/row
if I put it into model (setdata) then i don't have access to other members
of list because this works over single item
if i put it into dialogbox class, this could work, but i would have to
generate somehow information about what checkbox was ticked and whether it
is inside of selection....
did anyone do already something similar?/
thanks
d.
Message 2 in thread
It seems to me that checking the other selected items when one is
checked is merely emulating what a user would do. Since the user
interacts with the view, I think that is the logical place for this
logic. That means you have to derive from QListView and perform this
logic in your derivation. Then when the checkboxes get checked,
setModelData will be called on the delegate to propagate the change to
your model.
HTH,
Susan
dejfson wrote:
> Dear Experts,
> could someone tell where/how is the best place to do following:
>
> i have qlistview item, first column contains only checkbox persistent
> editors. The list view has extended selectability. What I'd like to do is
> if I select multiple rows and then check the checkbox of one of the
> rows selected, i'd like to check/uncheck the checkboxes of all rows
> which are selected..
>
> and now the question is where to put this code....
>
> if i put it into delegate (setmodeldata), then i'm not able to get
> the information about what checkbox is assigned to what modelindex/row
>
> if I put it into model (setdata) then i don't have access to other
> members of list because this works over single item
>
> if i put it into dialogbox class, this could work, but i would have to
> generate somehow information about what checkbox was ticked and
> whether it is inside of selection....
>
> did anyone do already something similar?/
>
> thanks
> d.
>
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
--
[ signature omitted ]