Re: Checkbox in QTreeView
IMHO the 2nd way, without editor in delegate is the way You should go.
This will work like this
QTreeView part:
-> user click on index in QTreeView, change model data (signal click(QModelIndex)) - toggle currently stored value from 0 to 1 and from 1 to 0
QAbstractItemDelegate part:
-> paint() paint's checkbox and use that int value to determine what state it should has. setEditorData() (<- You don't need this one when You don't createEditor()) taht way code is simpler for this purpouse IMHO
Model part:
-> setData(), data()
I don't want write here code for You, but what can help You are examples, especially:
model = qtdir/examples/itemviews/editabletreemodel
delegate = qtdir/examples/itemviews/coloreditorfactory (use checkBox, example uses combobox)
Last edited by Talei; 9th July 2011 at 00:00.
Reason: updated contents
In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
The advance of computerization however, has not yet wiped out nations and ethnic groups.
Bookmarks