PDA

View Full Version : Setting a single step value in a QTreeWidget



pcheng
13th August 2012, 10:40
Is there a way to set the single step of an item to 0.5 instead of 1?

What I need is for the user to edit the value in a column and when the arrows appear the values should change in increments of 0.5.

Any help will be appreciated.

Pericles

StrikeByte
13th August 2012, 12:32
I dont think it is possible for a QTreeWidgetItem to change the editor

what you can do is to create an QTreeModel and use a QTreeView to show the data
then you can use a QStyledItemDelegate to change the editor for a column

check out the zipcode1 example from this page http://www.qtrac.eu/aqpbook.html (download the aqpbook.zip)
they use an QStandardItemModel together with a QListView