summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qitemeditorfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews/qitemeditorfactory.cpp')
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 5162a5534c..5f24c3ea1b 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -73,6 +73,36 @@ public:
#endif // QT_NO_COMBOBOX
+
+#ifndef QT_NO_SPINBOX
+
+class QUIntSpinBox : public QSpinBox
+{
+ Q_OBJECT
+ Q_PROPERTY(uint value READ uintValue WRITE setUIntValue NOTIFY uintValueChanged USER true)
+public:
+ explicit QUIntSpinBox(QWidget *parent = 0)
+ : QSpinBox(parent)
+ {
+ connect(this, SIGNAL(valueChanged(int)), SIGNAL(uintValueChanged()));
+ }
+
+ uint uintValue()
+ {
+ return value();
+ }
+
+ void setUIntValue(uint value_)
+ {
+ return setValue(value_);
+ }
+
+Q_SIGNALS:
+ void uintValueChanged();
+};
+
+#endif // QT_NO_SPINBOX
+
/*!
\class QItemEditorFactory
\brief The QItemEditorFactory class provides widgets for editing item data
@@ -206,8 +236,9 @@ QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent)
#endif
#ifndef QT_NO_SPINBOX
case QVariant::UInt: {
- QSpinBox *sb = new QSpinBox(parent);
+ QSpinBox *sb = new QUIntSpinBox(parent);
sb->setFrame(false);
+ sb->setMinimum(0);
sb->setMaximum(INT_MAX);
return sb; }
case QVariant::Int: {