summaryrefslogtreecommitdiff
path: root/src/gui/dialogs/qinputdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/dialogs/qinputdialog.cpp')
-rw-r--r--src/gui/dialogs/qinputdialog.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp
index e996ee9be4..2d13c9a29e 100644
--- a/src/gui/dialogs/qinputdialog.cpp
+++ b/src/gui/dialogs/qinputdialog.cpp
@@ -244,6 +244,9 @@ void QInputDialogPrivate::ensureLineEdit()
Q_Q(QInputDialog);
if (!lineEdit) {
lineEdit = new QLineEdit(q);
+#ifndef QT_NO_IM
+ qt_widget_private(lineEdit)->inheritsInputMethodHints = 1;
+#endif
lineEdit->hide();
QObject::connect(lineEdit, SIGNAL(textChanged(QString)),
q, SLOT(_q_textChanged(QString)));
@@ -255,6 +258,9 @@ void QInputDialogPrivate::ensureComboBox()
Q_Q(QInputDialog);
if (!comboBox) {
comboBox = new QComboBox(q);
+#ifndef QT_NO_IM
+ qt_widget_private(comboBox)->inheritsInputMethodHints = 1;
+#endif
comboBox->hide();
QObject::connect(comboBox, SIGNAL(editTextChanged(QString)),
q, SLOT(_q_textChanged(QString)));
@@ -1122,6 +1128,8 @@ void QInputDialog::done(int result)
be entered).
\a text is the default text which is placed in the line edit.
\a mode is the echo mode the line edit will use.
+ \a inputMethodHints is the input method hints that will be used in the
+ edit widget if an input method is active.
If \a ok is nonnull \e *\a ok will be set to true if the user pressed
\gui OK and to false if the user pressed \gui Cancel. The dialog's parent
@@ -1144,13 +1152,14 @@ void QInputDialog::done(int result)
QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode mode, const QString &text, bool *ok,
- Qt::WindowFlags flags)
+ Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
{
QInputDialog dialog(parent, flags);
dialog.setWindowTitle(title);
dialog.setLabelText(label);
dialog.setTextValue(text);
dialog.setTextEchoMode(mode);
+ dialog.setInputMethodHints(inputMethodHints);
int ret = dialog.exec();
if (ok)
@@ -1163,6 +1172,17 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
}
/*!
+ \internal
+*/
+// ### Qt 5: Use only the version above.
+QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label,
+ QLineEdit::EchoMode mode, const QString &text, bool *ok,
+ Qt::WindowFlags flags)
+{
+ return getText(parent, title, label, mode, text, ok, flags, Qt::ImhNone);
+}
+
+/*!
\since 4.5
Static convenience function to get an integer input from the user.
@@ -1272,6 +1292,8 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
be entered).
\a items is the string list which is inserted into the combobox.
\a current is the number of the item which should be the current item.
+ \a inputMethodHints is the input method hints that will be used if the
+ combobox is editable and an input method is active.
If \a editable is true the user can enter their own text; otherwise the
user may only select one of the existing items.
@@ -1296,7 +1318,7 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label,
const QStringList &items, int current, bool editable, bool *ok,
- Qt::WindowFlags flags)
+ Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
{
QString text(items.value(current));
@@ -1306,6 +1328,7 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
dialog.setComboBoxItems(items);
dialog.setTextValue(text);
dialog.setComboBoxEditable(editable);
+ dialog.setInputMethodHints(inputMethodHints);
int ret = dialog.exec();
if (ok)
@@ -1318,6 +1341,17 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
}
/*!
+ \internal
+*/
+// ### Qt 5: Use only the version above.
+QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label,
+ const QStringList &items, int current, bool editable, bool *ok,
+ Qt::WindowFlags flags)
+{
+ return getItem(parent, title, label, items, current, editable, ok, flags, Qt::ImhNone);
+}
+
+/*!
\obsolete
Use getInt() instead.