aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-07-11 17:42:43 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-11 16:58:42 -0700
commitaf9d62bac3add0de07744f3d8a42e3a058e32a41 (patch)
treea9d510538dab29065b1800b396331abbc5fe11ff /qt-ui/modeldelegates.h
parent3dbc5bfeaa554f519da0bed0abddddb17da26f20 (diff)
downloadsubsurface-af9d62bac3add0de07744f3d8a42e3a058e32a41.tar.gz
Fixed input in the DivePlanner table
Based on Glance's idea on rewritting the Delegates, but we don't need to redo the wheel as Qt already gives us the correct Delegate, we just need to set some boundaries on it before returning. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.h')
-rw-r--r--qt-ui/modeldelegates.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h
index e2b705e17..7679766e9 100644
--- a/qt-ui/modeldelegates.h
+++ b/qt-ui/modeldelegates.h
@@ -88,4 +88,24 @@ public:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
+class SpinBoxDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+public:
+ SpinBoxDelegate(int min, int max, QObject *parent = 0);
+ virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+private:
+ int min;
+ int max;
+};
+
+class DoubleSpinBoxDelegate : public QStyledItemDelegate {
+ Q_OBJECT
+public:
+ DoubleSpinBoxDelegate(qreal min, qreal max, QObject *parent = 0);
+ virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+private:
+ int min;
+ int max;
+};
+
#endif // MODELDELEGATES_H