PDA

View Full Version : Edit items on QTreeView + QDirModel



junior0007
22nd November 2007, 16:24
Hey guys,

i am wondering how to edit items within a QTreeView + QDirModel. Editing items is -by default- on doubleClick. That works. However since i want to use the doubleClick to open the selected files i need to have the renaming functionality on a rightClickEvent.

Unfortunately i can't find the right way. Can anybody give me a hand on that?

Thanks guys.
Junior0007

wysota
22nd November 2007, 17:10
Change the editTriggers property of the view.

mchara
23rd November 2007, 06:46
By defalut editing is not on double click but on click selected - those two are different actions that can be used together.

jpn
23rd November 2007, 07:07
By defalut editing is not on double click but on click selected - those two are different actions that can be used together.
To be exact, any QAbstractItemView uses edit triggers

QAbstractItemView::DoubleClicked|QAbstractItemView ::EditKeyPressed
by default, and QTableView adds

editTriggers|QAbstractItemView::AnyKeyPressed
to that.

mchara
23rd November 2007, 07:16
So my mistake, sorry.
but QAbstractItemView::SelectedClicked (| QAbstractItemView::EditKeyPressed) editTrigger is windows default behavior so there's no need to edit items on rightClicks.