summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp13
-rw-r--r--src/gui/widgets/qabstractspinbox.h2
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp1
-rw-r--r--src/gui/widgets/qspinbox.cpp9
4 files changed, 24 insertions, 1 deletions
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index 347f89a..2bf1cda 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -659,7 +659,6 @@ void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit)
d->edit->setParent(this);
d->edit->setFrame(false);
- d->edit->setAttribute(Qt::WA_InputMethodEnabled, false);
d->edit->setFocusProxy(this);
d->edit->setAcceptDrops(false);
@@ -690,6 +689,18 @@ void QAbstractSpinBox::interpretText()
d->interpret(EmitIfChanged);
}
+/*
+ Reimplemented in 4.6, so be careful.
+ */
+/*!
+ \reimp
+*/
+QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const
+{
+ Q_D(const QAbstractSpinBox);
+ return d->edit->inputMethodQuery(query);
+}
+
/*!
\reimp
*/
diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h
index 4e7fc3f..aa8905f 100644
--- a/src/gui/widgets/qabstractspinbox.h
+++ b/src/gui/widgets/qabstractspinbox.h
@@ -122,6 +122,8 @@ public:
void interpretText();
bool event(QEvent *event);
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const;
+
virtual QValidator::State validate(QString &input, int &pos) const;
virtual void fixup(QString &input) const;
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index 83bec68..4d34691 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -2390,6 +2390,7 @@ void QDateTimeEditPrivate::init(const QVariant &var)
q->setCalendarPopup(true);
#endif
updateTimeSpec();
+ q->setInputMethodHints(Qt::ImhPreferNumbers);
setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem);
}
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index c691eaf..295bf48 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -77,6 +77,8 @@ public:
QChar thousand;
inline void init() {
+ Q_Q(QSpinBox);
+ q->setInputMethodHints(Qt::ImhDigitsOnly);
setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem);
}
};
@@ -97,6 +99,11 @@ public:
// variables
int decimals;
QChar delimiter, thousand;
+
+ inline void init() {
+ Q_Q(QDoubleSpinBox);
+ q->setInputMethodHints(Qt::ImhFormattedNumbersOnly);
+ }
};
@@ -592,6 +599,8 @@ void QSpinBox::fixup(QString &input) const
QDoubleSpinBox::QDoubleSpinBox(QWidget *parent)
: QAbstractSpinBox(*new QDoubleSpinBoxPrivate(parent), parent)
{
+ Q_D(QDoubleSpinBox);
+ d->init();
}
/*!