diff --git a/src/mtsgui/rendersettingsdlg.cpp b/src/mtsgui/rendersettingsdlg.cpp index 9f4f1b0d..c99f3d8a 100644 --- a/src/mtsgui/rendersettingsdlg.cpp +++ b/src/mtsgui/rendersettingsdlg.cpp @@ -21,6 +21,24 @@ #include #include +class BetterSpinBox : public QSpinBox { +public: + BetterSpinBox(QWidget *parent) : QSpinBox(parent) { + setFrame(false); + setFocusPolicy(Qt::StrongFocus); + setMinimum(-1); + setMaximum(INT_MAX); + } + + bool event(QEvent *event) { + if(event->type() == QEvent::Wheel) { + event->ignore(); + return false; + } + return QSpinBox::event(event); + } +}; + class BetterDoubleSpinBox : public QDoubleSpinBox { public: BetterDoubleSpinBox(QWidget *parent) : QDoubleSpinBox(parent) { @@ -28,6 +46,7 @@ public: setMinimum(-std::numeric_limits::max()); setMaximum(std::numeric_limits::max()); setFrame(false); + setFocusPolicy(Qt::StrongFocus); } void morphNumericString(char *s) const { @@ -47,6 +66,14 @@ public: morphNumericString(tmp); return QString::fromAscii(tmp); } + + bool event(QEvent *event) { + if(event->type() == QEvent::Wheel) { + event->ignore(); + return false; + } + return QDoubleSpinBox::event(event); + } }; /* ====================== Some helper routines ====================== */ @@ -566,7 +593,9 @@ QWidget *PropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewI } QWidget *widget; - if (index.data().type() == QVariant::Double) + if (index.data().type() == QVariant::Int) + widget = new BetterSpinBox(parent); + else if (index.data().type() == QVariant::Double) widget = new BetterDoubleSpinBox(parent); else widget = QStyledItemDelegate::createEditor(parent, option, index);