|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
public final class QInputDialog
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.
QInputDialog
as well as other built-in Qt dialogs. 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)
|
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.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 |
---|
public static QInputDialog fromNativePointer(QNativePointer nativePointer)
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)
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));
getText()
, getInteger()
, and getItem()
.
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)
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));
getText()
, getInteger()
, and getItem()
.
public static java.lang.Double getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue, double maxValue, int decimals)
public static java.lang.Double getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue, double maxValue)
public static java.lang.Double getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value, double minValue)
public static java.lang.Double getDouble(QWidget parent, java.lang.String title, java.lang.String label, double value)
public static java.lang.Double getDouble(QWidget parent, java.lang.String title, java.lang.String label)
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)
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));
getText()
, getDouble()
, and getItem()
.
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)
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));
getText()
, getDouble()
, and getItem()
.
public static java.lang.Integer getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue, int maxValue, int step)
public static java.lang.Integer getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue, int maxValue)
public static java.lang.Integer getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value, int minValue)
public static java.lang.Integer getInteger(QWidget parent, java.lang.String title, java.lang.String label, int value)
public static java.lang.Integer getInteger(QWidget parent, java.lang.String title, java.lang.String label)
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)
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);
getText()
, getInteger()
, and getDouble()
.
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)
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);
getText()
, getInteger()
, and getDouble()
.
public static java.lang.String getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list, int current, boolean editable)
public static java.lang.String getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list, int current)
public static java.lang.String getItem(QWidget parent, java.lang.String title, java.lang.String label, java.util.List list)
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)
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);
getInteger()
, getDouble()
, and getItem()
.
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 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);
getInteger()
, getDouble()
, and getItem()
.
public static java.lang.String getText(QWidget parent, java.lang.String title, java.lang.String label, QLineEdit.EchoMode echo, java.lang.String text)
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);
getInteger()
, getDouble()
, and getItem()
.
public static java.lang.String getText(QWidget parent, java.lang.String title, java.lang.String label, QLineEdit.EchoMode echo)
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);
getInteger()
, getDouble()
, and getItem()
.
public static java.lang.String getText(QWidget parent, java.lang.String title, java.lang.String label)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |