summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r--qt-ui/modeldelegates.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index dc6af5665..8dfc56789 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -364,3 +364,31 @@ void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
}
QStyledItemDelegate::paint(painter, option, index);
}
+
+SpinBoxDelegate::SpinBoxDelegate(int min, int max, QObject *parent):
+ QStyledItemDelegate(parent),
+ min(min),
+ max(max)
+{
+}
+
+QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ QSpinBox *w = qobject_cast<QSpinBox*>(QStyledItemDelegate::createEditor(parent, option, index));
+ w->setRange(min,max);
+ return w;
+}
+
+DoubleSpinBoxDelegate::DoubleSpinBoxDelegate(qreal min, qreal max, QObject *parent):
+ QStyledItemDelegate(parent),
+ min(min),
+ max(max)
+{
+}
+
+QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ QDoubleSpinBox *w = qobject_cast<QDoubleSpinBox*>(QStyledItemDelegate::createEditor(parent, option, index));
+ w->setRange(min,max);
+ return w;
+}