Qt Jambi Home

com.trolltech.qt.gui
Class QInputDialog

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QDialog
                      extended by 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:

        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.

Input Dialogs

The Standard Dialogs example shows how to use QInputDialog as well as other built-in Qt dialogs.

See Also:
QMessageBox, 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<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
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 function 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)
          This is a overloaded function provided for convenience.
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)
          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<java.lang.String> 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<java.lang.String> 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<java.lang.String> 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<java.lang.String> 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<java.lang.String> list, int current, boolean editable, Qt.WindowType... f)
          This is a overloaded function provided for convenience.
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)
          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, java.lang.String text)
          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, 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)
          This is a overloaded function provided for convenience.
 
Methods inherited from class com.trolltech.qt.gui.QDialog
accept, adjustPosition, closeEvent, contextMenuEvent, done, eventFilter, exec, isSizeGripEnabled, keyPressEvent, minimumSizeHint, reject, resizeEvent, result, setModal, setResult, setSizeGripEnabled, setVisible, showEvent, sizeHint
 
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, contentsRect, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, event, 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, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, 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, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showFullScreen, showMaximized, showMinimized, showNormal, size, 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, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, 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 function returns the QInputDialog instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

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.

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.


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)
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,
                                         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 spin box 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.

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.


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)
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)
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<java.lang.String> 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 combo box, 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.

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 combo box.


getItem

public static java.lang.String getItem(QWidget parent,
                                       java.lang.String title,
                                       java.lang.String label,
                                       java.util.List<java.lang.String> list,
                                       int current,
                                       boolean editable,
                                       Qt.WindowType... f)
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<java.lang.String> 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<java.lang.String> 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<java.lang.String> 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.

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.


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)
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)
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)
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)
This is a overloaded function provided for convenience.


Qt Jambi Home