View Full Version : problem to use the QItemDelegate
mashi
20th July 2012, 10:35
Hi,
I have a problem to use the QItemDelegate:
I have a QTableView and an QAbstractTableModel associated.
Inside some cells of the table I set a custom ItemDelegate using a combobox.
Sometimes when I select quickly a field of the combobox , the setModelData method of the delegate is not called and the corresponding cell remains empty.
Conversely, If I select a field in the combobox slowly this problem does not occur.
Someone can help me??
Thank you and sorry for my bad english.:p
wysota
20th July 2012, 19:23
How do you "select quickly"?
mashi
24th July 2012, 15:05
Maybe is necessary a clarification:
the problem is appears when I tried to show the combobox at first click on cell of table;
in standard condition instead, I need to two clicks for show the combobox:
one click for the focus on the cell
the second one for show the combobox
To enable the display of the combobox with a single click, each time that I click on a cell, I call the method openPersistentEditor(),
passing the QModelIndex given by click event.
obviously when I click on another cell, I close the persistent editor preceding opened and so forth.
The interactions to do "quickly" and that show an problem are the following:
1) the first click on the cell for shows of the combobox;
2) the second click for expands the combobox
3) the third click for selects an item of the combobox (generally the second element)
When I lost focus on the cell, sometimes (3/10 in average) leaves the cell selection resulting empty
If I do this interactions "slowly" the problem doesn't happens.
with "quick selection" i meant: hitting three times the mouse button in rapid succession, as fast as I can
with "slow selection" i meant: as the quick one, but leaving half a second between clicks
NB: If I remove the "ONE CLICK" function the problem doesn't happens.
Thanks
Diego.
thomas@itest
24th July 2012, 15:45
hi,
why not using QAbstractItemView::setItemDelegate ?
wysota
24th July 2012, 16:12
To enable the display of the combobox with a single click, each time that I click on a cell, I call the method openPersistentEditor()
And why not QAbstractItemView::edit()?
mashi
25th July 2012, 15:27
thanks a lot, with QAbstractItemView::edit() i have resolve my problem!!;););)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.