Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QInputDialog

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QWidget
                      com.trolltech.qt.gui.QDialog
                          com.trolltech.qt.gui.QInputDialog

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public final class QInputDialog

extends QDialog

The `QInputDialog` class provides a simple convenience dialog to get a single value from the user. The input value can be a string, a number or an item from a list. A label must be set to tell the user what they should enter.

Four static convenience functions are provided: `getText()`, `getInteger()`, `getDouble()` and `getItem()`. All the functions can be used in a similar way, for example:
The following code example is written in c++.

        bool ok;
        QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                             tr("User name:"), QLineEdit::Normal,
                                             QDir::home().dirName(), &ok);
        if (ok && !text.isEmpty())
            textLabel->setText(text);

The `ok` variable is set to true if the user clicks OK; otherwise it is set to false.
The Standard Dialogs example shows how to use `QInputDialog` as well as other built-in Qt dialogs.

See also:
  `QMessageBox`, and Standard Dialogs Example.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QDialog
`QDialog.DialogCode`

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Field Summary

Fields inherited from class com.trolltech.qt.gui.QDialog
`accepted, finished, rejected`

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Method Summary
`static QInputDialog` | `fromNativePointer(QNativePointer nativePointer)` This method returns the QInputDialog instance pointed to by `nativePointer`.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label)` This is a overloaded function provided for convenience.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value)` This is a overloaded function provided for convenience.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue)` This is a overloaded function provided for convenience.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue, double maxValue)` This is a overloaded function provided for convenience.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue, double maxValue, int decimals)` This is a overloaded function provided for convenience.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue, double maxValue, int decimals, Qt.WindowFlags f)` Static convenience function to get a floating point number from the user.
`static java.lang.Double` | `getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue, double maxValue, int decimals, Qt.WindowType[] f)` Static convenience function to get a floating point number from the user.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label)` This is a overloaded function provided for convenience.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value)` This is a overloaded function provided for convenience.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue)` This is a overloaded function provided for convenience.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue, int maxValue)` This is a overloaded function provided for convenience.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue, int maxValue, int step)` This is a overloaded function provided for convenience.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue, int maxValue, int step, Qt.WindowFlags f)` Static convenience function to get an integer input from the user.
`static java.lang.Integer` | `getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue, int maxValue, int step, Qt.WindowType[] f)` Static convenience function to get an integer input from the user.
`static java.lang.String` | `getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list)` This is a overloaded function provided for convenience.
`static java.lang.String` | `getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list, int current)` This is a overloaded function provided for convenience.
`static java.lang.String` | `getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list, int current, boolean editable)` This is a overloaded function provided for convenience.
`static java.lang.String` | `getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list, int current, boolean editable, Qt.WindowFlags f)` Static convenience function to let the user select an item from a string list.
`static java.lang.String` | `getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list, int current, boolean editable, Qt.WindowType[] f)` Static convenience function to let the user select an item from a string list.
`static java.lang.String` | `getText(QWidget parent, java.lang.String title, java.lang.String label)` This is a overloaded function provided for convenience.
`static java.lang.String` | `getText(QWidget parent, java.lang.String title, java.lang.String label, QLineEdit.EchoMode echo)` Static convenience function to get a string from the user.
`static java.lang.String` | `getText(QWidget parent, java.lang.String title, java.lang.String label, QLineEdit.EchoMode echo, java.lang.String text)` Static convenience function to get a string from the user.
`static java.lang.String` | `getText(QWidget parent, java.lang.String title, java.lang.String label, QLineEdit.EchoMode echo, java.lang.String text, Qt.WindowFlags f)` Static convenience function to get a string from the user.
`static java.lang.String` | `getText(QWidget parent, java.lang.String title, java.lang.String label, QLineEdit.EchoMode echo, java.lang.String text, Qt.WindowType[] f)` Static convenience function to get a string from the user.

Methods inherited from class com.trolltech.qt.gui.QDialog
`accept, done, exec, isSizeGripEnabled, reject, result, setModal, setResult, setSizeGripEnabled`

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Method Detail

### fromNativePointer

    public static QInputDialog fromNativePointer(QNativePointer nativePointer)

  This method returns the QInputDialog instance pointed to by `nativePointer`.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label,
                                             double value,
                                             double minValue,
                                             double maxValue,
                                             int decimals,
                                             Qt.WindowFlags f)

  Static convenience function to get a floating point number from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `value` is the default floating point number that the line edit will be set to. `minValue` and `maxValue` are the minimum and maximum values the user may choose, and `decimals` is the maximum number of decimal places the number may have.

  If `ok` is non-null, *`ok` will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the floating point number which has been entered by the user.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
                                             tr("Amount:"), 37.56, -10000, 10000, 2, &ok);
          if (ok)
              doubleLabel->setText(QString("$%1").arg(d));

See also:
  `getText()`, `getInteger()`, and `getItem()`.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label,
                                             double value,
                                             double minValue,
                                             double maxValue,
                                             int decimals,
                                             Qt.WindowType[] f)

  Static convenience function to get a floating point number from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `value` is the default floating point number that the line edit will be set to. `minValue` and `maxValue` are the minimum and maximum values the user may choose, and `decimals` is the maximum number of decimal places the number may have.

  If `ok` is non-null, *`ok` will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the floating point number which has been entered by the user.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
                                             tr("Amount:"), 37.56, -10000, 10000, 2, &ok);
          if (ok)
              doubleLabel->setText(QString("$%1").arg(d));

See also:
  `getText()`, `getInteger()`, and `getItem()`.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label,
                                             double value,
                                             double minValue,
                                             double maxValue,
                                             int decimals)

  This is a overloaded function provided for convenience.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label,
                                             double value,
                                             double minValue,
                                             double maxValue)

  This is a overloaded function provided for convenience.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label,
                                             double value,
                                             double minValue)

  This is a overloaded function provided for convenience.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label,
                                             double value)

  This is a overloaded function provided for convenience.

### getDouble

    public static java.lang.Double getDouble(QWidget parent,
                                             java.lang.String title,
                                             java.lang.String label)

  This is a overloaded function provided for convenience.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label,
                                               int value,
                                               int minValue,
                                               int maxValue,
                                               int step,
                                               Qt.WindowFlags f)

  Static convenience function to get an integer input from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `value` is the default integer which the spinbox will be set to. `minValue` and `maxValue` are the minimum and maximum values the user may choose, and `step` is the amount by which the values change as the user presses the arrow buttons to increment or decrement the value.

  If `ok` is non-null *`ok` will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the integer which has been entered by the user.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          int i = QInputDialog::getInteger(this, tr("QInputDialog::getInteger()"),
                                           tr("Percentage:"), 25, 0, 100, 1, &ok);
          if (ok)
              integerLabel->setText(tr("%1%").arg(i));

See also:
  `getText()`, `getDouble()`, and `getItem()`.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label,
                                               int value,
                                               int minValue,
                                               int maxValue,
                                               int step,
                                               Qt.WindowType[] f)

  Static convenience function to get an integer input from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `value` is the default integer which the spinbox will be set to. `minValue` and `maxValue` are the minimum and maximum values the user may choose, and `step` is the amount by which the values change as the user presses the arrow buttons to increment or decrement the value.

  If `ok` is non-null *`ok` will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the integer which has been entered by the user.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          int i = QInputDialog::getInteger(this, tr("QInputDialog::getInteger()"),
                                           tr("Percentage:"), 25, 0, 100, 1, &ok);
          if (ok)
              integerLabel->setText(tr("%1%").arg(i));

See also:
  `getText()`, `getDouble()`, and `getItem()`.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label,
                                               int value,
                                               int minValue,
                                               int maxValue,
                                               int step)

  This is a overloaded function provided for convenience.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label,
                                               int value,
                                               int minValue,
                                               int maxValue)

  This is a overloaded function provided for convenience.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label,
                                               int value,
                                               int minValue)

  This is a overloaded function provided for convenience.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label,
                                               int value)

  This is a overloaded function provided for convenience.

### getInteger

    public static java.lang.Integer getInteger(QWidget parent,
                                               java.lang.String title,
                                               java.lang.String label)

  This is a overloaded function provided for convenience.

### getItem

    public static java.lang.String getItem(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           java.util.List list,
                                           int current,
                                           boolean editable,
                                           Qt.WindowFlags f)

  Static convenience function to let the user select an item from a string list. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `list` is the string list which is inserted into the combobox, and `current` is the number of the item which should be the current item. If `editable` is true the user can enter their own text; if `editable` is false the user may only select one of the existing items.

  If `ok` is non-null *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the text of the current item, or if `editable` is true, the current text of the combobox.

  Use this static function like this:
  The following code example is written in c++.

          QStringList items;
          items << tr("Spring") << tr("Summer") << tr("Fall") << tr("Winter");

          bool ok;
          QString item = QInputDialog::getItem(this, tr("QInputDialog::getItem()"),
                                               tr("Season:"), items, 0, false, &ok);
          if (ok && !item.isEmpty())
              itemLabel->setText(item);

See also:
  `getText()`, `getInteger()`, and `getDouble()`.

### getItem

    public static java.lang.String getItem(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           java.util.List list,
                                           int current,
                                           boolean editable,
                                           Qt.WindowType[] f)

  Static convenience function to let the user select an item from a string list. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `list` is the string list which is inserted into the combobox, and `current` is the number of the item which should be the current item. If `editable` is true the user can enter their own text; if `editable` is false the user may only select one of the existing items.

  If `ok` is non-null *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the text of the current item, or if `editable` is true, the current text of the combobox.

  Use this static function like this:
  The following code example is written in c++.

          QStringList items;
          items << tr("Spring") << tr("Summer") << tr("Fall") << tr("Winter");

          bool ok;
          QString item = QInputDialog::getItem(this, tr("QInputDialog::getItem()"),
                                               tr("Season:"), items, 0, false, &ok);
          if (ok && !item.isEmpty())
              itemLabel->setText(item);

See also:
  `getText()`, `getInteger()`, and `getDouble()`.

### getItem

    public static java.lang.String getItem(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           java.util.List list,
                                           int current,
                                           boolean editable)

  This is a overloaded function provided for convenience.

### getItem

    public static java.lang.String getItem(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           java.util.List list,
                                           int current)

  This is a overloaded function provided for convenience.

### getItem

    public static java.lang.String getItem(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           java.util.List list)

  This is a overloaded function provided for convenience.

### getText

    public static java.lang.String getText(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           QLineEdit.EchoMode echo,
                                           java.lang.String text,
                                           Qt.WindowFlags f)

  Static convenience function to get a string from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `text` is the default text which is placed in the line edit. The `mode` is the echo mode the line edit will use. If `ok` is non-null *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the text which has been entered in the line edit. It will not return an empty string.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                               tr("User name:"), QLineEdit::Normal,
                                               QDir::home().dirName(), &ok);
          if (ok && !text.isEmpty())
              textLabel->setText(text);

See also:
  `getInteger()`, `getDouble()`, and `getItem()`.

### getText

    public static java.lang.String getText(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           QLineEdit.EchoMode echo,
                                           java.lang.String text,
                                           Qt.WindowType[] f)

  Static convenience function to get a string from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `text` is the default text which is placed in the line edit. The `mode` is the echo mode the line edit will use. If `ok` is non-null *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the text which has been entered in the line edit. It will not return an empty string.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                               tr("User name:"), QLineEdit::Normal,
                                               QDir::home().dirName(), &ok);
          if (ok && !text.isEmpty())
              textLabel->setText(text);

See also:
  `getInteger()`, `getDouble()`, and `getItem()`.

### getText

    public static java.lang.String getText(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           QLineEdit.EchoMode echo,
                                           java.lang.String text)

  Static convenience function to get a string from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `text` is the default text which is placed in the line edit. The `mode` is the echo mode the line edit will use. If `ok` is non-null *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the text which has been entered in the line edit. It will not return an empty string.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                               tr("User name:"), QLineEdit::Normal,
                                               QDir::home().dirName(), &ok);
          if (ok && !text.isEmpty())
              textLabel->setText(text);

See also:
  `getInteger()`, `getDouble()`, and `getItem()`.

### getText

    public static java.lang.String getText(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label,
                                           QLineEdit.EchoMode echo)

  Static convenience function to get a string from the user. `title` is the text which is displayed in the title bar of the dialog. `label` is the text which is shown to the user (it should say what should be entered). `text` is the default text which is placed in the line edit. The `mode` is the echo mode the line edit will use. If `ok` is non-null *a ok will be set to true if the user pressed OK and to false if the user pressed Cancel. The dialog's parent is `parent`. The dialog will be modal and uses the widget flags `f`.

  This function returns the text which has been entered in the line edit. It will not return an empty string.

  Use this static function like this:
  The following code example is written in c++.

          bool ok;
          QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                               tr("User name:"), QLineEdit::Normal,
                                               QDir::home().dirName(), &ok);
          if (ok && !text.isEmpty())
              textLabel->setText(text);

See also:
  `getInteger()`, `getDouble()`, and `getItem()`.

### getText

    public static java.lang.String getText(QWidget parent,
                                           java.lang.String title,
                                           java.lang.String label)

  This is a overloaded function provided for convenience.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD