summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs/qinputdialog.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-10-01 12:50:52 (GMT)
committeraxis <qt-info@nokia.com>2010-10-08 13:28:44 (GMT)
commit4b73e816189d924bd499fc8b7fb29365539d5e38 (patch)
treeeb4072afb9a74fb07e3d01cc7f2ee6204828d41c /src/gui/dialogs/qinputdialog.cpp
parenta7eab236ca29a06180faa43f982365ae646bb9a3 (diff)
downloadQt-4b73e816189d924bd499fc8b7fb29365539d5e38.zip
Qt-4b73e816189d924bd499fc8b7fb29365539d5e38.tar.gz
Qt-4b73e816189d924bd499fc8b7fb29365539d5e38.tar.bz2
Extended the convenience functions for QInputDialog for IM hints.
Input method hints make a lot of sense when requesting specific information from the user, such as for example a URL. Therefore we include input method hints in the static convenience function. To maintain BC we need to keep the old symbol around, so a new function was added. To maintain SC, there cannot be any ambiguities when deciding which function to link to, therefore the function with the fewest arguments get to keep all the default arguments, whereas the new function gets a new explicit argument. AutoTest: Passed Task: QTBUG-13200 RevBy: Denis Dzyubenko
Diffstat (limited to 'src/gui/dialogs/qinputdialog.cpp')
-rw-r--r--src/gui/dialogs/qinputdialog.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp
index 700b234..2d13c9a 100644
--- a/src/gui/dialogs/qinputdialog.cpp
+++ b/src/gui/dialogs/qinputdialog.cpp
@@ -1128,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
@@ -1150,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)
@@ -1169,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.
@@ -1278,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.
@@ -1302,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));
@@ -1312,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)
@@ -1324,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.