View Full Version : QDataWidgetMapper QSpinBox setFlags problem

17th February 2011, 06:55
Hi all,

I'm trying to setup a QDataWidgetMapper with 3 widgets: QTreeWidget, QComboBox, QSpinBox.

The items are represented by QStandardItem. However when I do setFlags, the new flags are not reflected in those widgets.

e.g I install the following to QSpinBox

QStandardItem *item = new QStandardItem();
item->setFlags(item->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsSelectable);

but in the QSpinBox, this item is still editable....

The reason that I use a QDataWidgetMapper is because it can map QStandardItem to QSpinBox where I can set flags, whereas QSpinBox itself doesn't accept QStandardItem, only QString iirc.