CopperSpice API  1.9.1
QInputDialog Class Reference

The QInputDialog class provides a simple convenience dialog to get a single value from the user. More...

Inheritance diagram for QInputDialog:
QDialog QWidget QObject QPaintDevice

Public Typedefs

using InputDialogOptions = QFlags< InputDialogOption >
 
- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >
 

Public Types

enum  InputDialogOption
 
enum  InputMode
 
- Public Types inherited from QDialog
enum  DialogCode
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 

Public Signals

void doubleValueChanged (double value)
 
void doubleValueSelected (double value)
 
void intValueChanged (int value)
 
void intValueSelected (int value)
 
void textValueChanged (const QString &text)
 
void textValueSelected (const QString &text)
 
- Public Signals inherited from QDialog
void accepted ()
 
void finished (int result)
 
void rejected ()
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

virtual void open ()
 
- Public Slots inherited from QDialog
virtual void accept ()
 
virtual void done (int result)
 
virtual int exec ()
 
virtual void open ()
 
virtual void reject ()
 
void showExtension (bool showExt)
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QInputDialog (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QInputDialog ()
 
QString cancelButtonText () const
 
QStringList comboBoxItems () const
 
void done (int result) override
 
int doubleDecimals () const
 
double doubleMaximum () const
 
double doubleMinimum () const
 
double doubleValue () const
 
InputMode inputMode () const
 
int intMaximum () const
 
int intMinimum () const
 
int intStep () const
 
int intValue () const
 
bool isComboBoxEditable () const
 
QString labelText () const
 
QSize minimumSizeHint () const override
 
QString okButtonText () const
 
void open (QObject *receiver, const QString &member)
 
InputDialogOptions options () const
 
void setCancelButtonText (const QString &text)
 
void setComboBoxEditable (bool editable)
 
void setComboBoxItems (const QStringList &items)
 
void setDoubleDecimals (int decimals)
 
void setDoubleMaximum (double max)
 
void setDoubleMinimum (double min)
 
void setDoubleRange (double min, double max)
 
void setDoubleValue (double value)
 
void setInputMode (InputMode mode)
 
void setIntMaximum (int max)
 
void setIntMinimum (int min)
 
void setIntRange (int min, int max)
 
void setIntStep (int step)
 
void setIntValue (int value)
 
void setLabelText (const QString &text)
 
void setOkButtonText (const QString &text)
 
void setOption (InputDialogOption option, bool on=true)
 
void setOptions (InputDialogOptions options)
 
void setTextEchoMode (QLineEdit::EchoMode mode)
 
void setTextValue (const QString &text)
 
void setVisible (bool visible) override
 
QSize sizeHint () const override
 
bool testOption (InputDialogOption option) const
 
QLineEdit::EchoMode textEchoMode () const
 
QString textValue () const
 
- Public Methods inherited from QDialog
 QDialog (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QDialog ()
 
QWidgetextension () const
 
bool isSizeGripEnabled () const
 
Qt::Orientation orientation () const
 
int result () const
 
void setExtension (QWidget *extension)
 
void setModal (bool modal)
 
void setOrientation (Qt::Orientation orientation)
 
void setResult (int result)
 
void setSizeGripEnabled (bool enabled)
 
void setVisible (bool visible) override
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Static Public Methods

static double getDouble (QWidget *parent, const QString &title, const QString &label, double value=0, double minValue=-2147483647, double maxValue=2147483647, int decimals=1, bool *ok=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static int getInt (QWidget *parent, const QString &title, const QString &label, int value=0, int minValue=-2147483647, int maxValue=2147483647, int step=1, bool *ok=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QString getItem (QWidget *parent, const QString &title, const QString &label, const QStringList &items, int current=0, bool editable=true, bool *ok=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag, Qt::InputMethodHints inputMethodHints=Qt::ImhNone)
 
static QString getMultiLineText (QWidget *parent, const QString &title, const QString &label, const QString &text=QString (), bool *ok=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag, Qt::InputMethodHints inputMethodHints=Qt::ImhNone)
 
static QString getText (QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode echoMode=QLineEdit::Normal, const QString &text=QString (), bool *ok=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag, Qt::InputMethodHints inputMethodHints=Qt::ImhNone)
 
- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Properties

 cancelButtonText
 
 comboBoxEditable
 
 comboBoxItems
 
 doubleDecimals
 
 doubleMaximum
 
 doubleMinimum
 
 doubleValue
 
 inputMode
 
 intMaximum
 
 intMinimum
 
 intStep
 
 intValue
 
 labelText
 
 okButtonText
 
 options
 
 textEchoMode
 
 textValue
 
- Properties inherited from QDialog
 modal
 
 sizeGripEnabled
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Protected Slots inherited from QWidget
void updateMicroFocus ()
 
- Protected Methods inherited from QDialog
void closeEvent (QCloseEvent *event) override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
bool eventFilter (QObject *object, QEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void showEvent (QShowEvent *event) override
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
virtual void changeEvent (QEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 
virtual void dropEvent (QDropEvent *event)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
virtual void focusInEvent (QFocusEvent *event)
 
bool focusNextChild ()
 
virtual bool focusNextPrevChild (bool next)
 
virtual void focusOutEvent (QFocusEvent *event)
 
bool focusPreviousChild ()
 
virtual void hideEvent (QHideEvent *event)
 
void initPainter (QPainter *painter) const override
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void tabletEvent (QTabletEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Detailed Description

The QInputDialog class provides a dialog to accept 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 methods are also available: getText(), getInt(), getDouble(), and getItem().

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
See also
QMessageBox

Member Typedef Documentation

Member Enumeration Documentation

This enum specifies various options that affect the look and feel of an input dialog.

ConstantValueDescription
QInputDialog::NoButtons 0x00000001 Do not display OK and Cancel buttons (useful for "live dialogs").
QInputDialog::UseListViewForComboBoxItems 0x00000002 Use a QListView rather than a non-editable QComboBox for displaying the items set with setComboBoxItems().
QInputDialog::UsePlainTextEditForTextInput 0x00000004 Use a QPlainTextEdit for multiline text input.
See also
options, setOption(), testOption()

This enum describes the different modes of input that can be selected for the dialog.

ConstantValueDescription
QInputDialog::TextInput 0 Used to input text strings.
QInputDialog::IntInput 1 Used to input integers.
QInputDialog::DoubleInput 2 Used to input floating point numbers with double precision accuracy.
See also
inputMode

Constructor & Destructor Documentation

QInputDialog::QInputDialog ( QWidget parent = nullptr,
Qt::WindowFlags  flags = Qt::EmptyFlag 
)

Constructs a new input dialog with the given parent and window flags.

QInputDialog::~QInputDialog ( )

Destroys the input dialog.

Method Documentation

QString QInputDialog::cancelButtonText ( ) const

Returns the value of the property.

QStringList QInputDialog::comboBoxItems ( ) const

Returns the value of the property.

void QInputDialog::done ( int  result)
override

Closes the dialog and sets its result code to result. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return result.

See also
QDialog::done()
int QInputDialog::doubleDecimals ( ) const

Returns the value of the property.

double QInputDialog::doubleMaximum ( ) const

Returns the value of the property.

double QInputDialog::doubleMinimum ( ) const

Returns the value of the property.

double QInputDialog::doubleValue ( ) const

Returns the value of the property.

void QInputDialog::doubleValueChanged ( double  value)
signal

This signal is emitted whenever the double value changes in the dialog. The current value is specified by value. This signal is only relevant when the input dialog is used in DoubleInput mode.

void QInputDialog::doubleValueSelected ( double  value)
signal

This signal is emitted whenever the user selects a double value by accepting the dialog, for example, by clicking the OK button. The selected value is specified by value. This signal is only relevant when the input dialog is used in DoubleInput mode.

double QInputDialog::getDouble ( QWidget parent,
const QString title,
const QString label,
double  value = 0,
double  minValue = -2147483647,
double  maxValue = 2147483647,
int  decimals = 1,
bool *  ok = nullptr,
Qt::WindowFlags  flags = Qt::EmptyFlag 
)
static

Static method to get a floating point number from the user.

The title is the text which is displayed in the title bar of the dialog. The label is the text which is shown to the user. The value is the default floating point number that the line edit will be set to. The minValue and maxValue are the minimum and maximum values the user may choose. The decimals is the maximum number of decimal places the number may have.

If ok is not a nullptr it 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.

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

bool ok;
double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"), tr("Amount:"), 37.56, -10000, 10000, 2, &ok);
if (ok) {
doubleLabel->setText(QString("$%1").formatArg(d));
}
Warning
Do not delete parent during the execution of the dialog. If you want to do this, create the dialog yourself using one of the QInputDialog constructors.
See also
getText(), getInt(), getItem()
int QInputDialog::getInt ( QWidget parent,
const QString title,
const QString label,
int  value = 0,
int  minValue = -2147483647,
int  maxValue = 2147483647,
int  step = 1,
bool *  ok = nullptr,
Qt::WindowFlags  flags = Qt::EmptyFlag 
)
static

Static method to get an integer input from the user.

The title is the text which is displayed in the title bar of the dialog. The label is the text which is shown to the user. The value is the default integer which the spinbox will be set to. The minValue and maxValue are the minimum and maximum values the user may choose. The 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 not a nullptr it 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.

On success, this method returns the integer which has been entered by the user. On failure it returns the passed value.

bool ok;
int i = QInputDialog::getInt(this, tr("QInputDialog::getInteger()"), tr("Percentage:"), 25, 0, 100, 1, &ok);
if (ok) {
integerLabel->setText(tr("%1%").formatArg(i));
}
Warning
Do not delete parent during the execution of the dialog. If you want to do this, create the dialog yourself using one of the QInputDialog constructors.
See also
getText(), getDouble(), getItem()
QString QInputDialog::getItem ( QWidget parent,
const QString title,
const QString label,
const QStringList items,
int  current = 0,
bool  editable = true,
bool *  ok = nullptr,
Qt::WindowFlags  flags = Qt::EmptyFlag,
Qt::InputMethodHints  inputMethodHints = Qt::ImhNone 
)
static

Static method to let the user select an item from a string list.

The title is the text which is displayed in the title bar of the dialog. The label is the text which is shown to the user. The items is the string list which is inserted into the combobox. The current is the number of the item which should be the current item. The inputMethodHints is the input method hints that will be used if the combobox is editable and an input method is active.

If editable is true the user can enter their own text, otherwise the user may only select one of the existing items.

If ok is not a nullptr it 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.

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

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);
}
Warning
Do not delete parent during the execution of the dialog. If you want to do this, create the dialog yourself using one of the QInputDialog constructors.
See also
getText(), getInt(), getDouble()
QString QInputDialog::getMultiLineText ( QWidget parent,
const QString title,
const QString label,
const QString text = QString(),
bool *  ok = nullptr,
Qt::WindowFlags  flags = Qt::EmptyFlag,
Qt::InputMethodHints  inputMethodHints = Qt::ImhNone 
)
static

Used to get a multiline string from the user. The parameter parent is used as the parent of this dialog. The dialog will be modal and uses the specified widget flags.

The parameter title is the text which is displayed in the title bar of the dialog. The label is the text which describes what type of data is being requested from the users. The text parameter is the default text which is placed in the plain text edit. The inputMethodHints is the a hint that will be used in the edit widget if an input method is active.

If ok is not null then the value it points to will be set to true if the user pressed OK and to false if the user pressed CANCEL. If the user presses OK this method will return the text in the dialog's plain text edit. If the dialog is rejected, an empty QString is returned.

bool ok;
QString text = QInputDialog::getMultiLineText(this, "QInputDialog::getMultiLineText()", "Address:", "100 Main Street", &ok);
if (ok && ! text.isEmpty()) {
multiLineTextLabel->setText(text);
}
See also
getInt(), getDouble(), getItem(), getText()
QString QInputDialog::getText ( QWidget parent,
const QString title,
const QString label,
QLineEdit::EchoMode  echoMode = QLineEdit::Normal,
const QString text = QString(),
bool *  ok = nullptr,
Qt::WindowFlags  flags = Qt::EmptyFlag,
Qt::InputMethodHints  inputMethodHints = Qt::ImhNone 
)
static

Static method to get a string from the user.

The title is the text which is displayed in the title bar of the dialog. The label is the text which is shown to the user. The text is the default text which is placed in the line edit. The echoMode is the echo mode the line edit will use. The inputMethodHints is the input method hints that will be used in the edit widget if an input method is active.

If ok is not a nullptr it 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 specified widget flags.

If the dialog is accepted this method returns the text in the dialog's line edit. If the dialog is rejected, an empty QString is returned.

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);
}
Warning
Do not delete parent during the execution of the dialog. If you want to do this, create the dialog yourself using one of the QInputDialog constructors.
See also
getInt(), getDouble(), getItem()
InputMode QInputDialog::inputMode ( ) const

Returns the value of the property.

int QInputDialog::intMaximum ( ) const

Returns the value of the property.

int QInputDialog::intMinimum ( ) const

Returns the value of the property.

int QInputDialog::intStep ( ) const

Returns the value of the property.

int QInputDialog::intValue ( ) const

Returns the value of the property.

void QInputDialog::intValueChanged ( int  value)
signal

This signal is emitted whenever the integer value changes in the dialog. The current value is specified by value. This signal is only relevant when the input dialog is used in IntInput mode.

void QInputDialog::intValueSelected ( int  value)
signal

This signal is emitted whenever the user selects an integer value by accepting the dialog; for example, by clicking the OK button. The selected value is specified by value. The signal is only relevant when the input dialog is used in IntInput mode.

bool QInputDialog::isComboBoxEditable ( ) const

Returns the value of the property.

QString QInputDialog::labelText ( ) const

Returns the value of the property.

QSize QInputDialog::minimumSizeHint ( ) const
overridevirtual

Reimplemented from QDialog::minimumSizeHint()

QString QInputDialog::okButtonText ( ) const

Returns the value of the property.

void QDialog::open ( )
usingslot

Shows the dialog as a window modal dialog, returning immediately.

See also
exec(), show(), result(), setWindowModality()
void QInputDialog::open ( QObject receiver,
const QString member 
)

This method connects one of its signals to the slot specified by receiver and member. The specific signal depends on the arguments that are specified in member. The signal will be disconnected from the slot when the dialog is closed.

InputDialogOptions QInputDialog::options ( ) const

Returns the value of the property.

void QInputDialog::setCancelButtonText ( const QString text)

Sets the value of the property to text.

void QInputDialog::setComboBoxEditable ( bool  editable)

Sets the value of the property to editable.

void QInputDialog::setComboBoxItems ( const QStringList items)

Sets the value of the property to items.

void QInputDialog::setDoubleDecimals ( int  decimals)

Sets the value of the property to decimals.

void QInputDialog::setDoubleMaximum ( double  max)

Sets the value of the property to max.

void QInputDialog::setDoubleMinimum ( double  min)

Sets the value of the property to min.

void QInputDialog::setDoubleRange ( double  min,
double  max 
)

Sets the range of double precision floating point values accepted by the dialog when used in DoubleInput mode, with minimum and maximum values specified by min and max respectively.

void QInputDialog::setDoubleValue ( double  value)

Sets the value of the property to value.

void QInputDialog::setInputMode ( InputMode  mode)

Sets the value of the property to mode.

void QInputDialog::setIntMaximum ( int  max)

Sets the value of the property to max.

void QInputDialog::setIntMinimum ( int  min)

Sets the value of the property to min.

void QInputDialog::setIntRange ( int  min,
int  max 
)

Sets the range of integer values accepted by the dialog when used in IntInput mode, with minimum and maximum values specified by min and max respectively.

void QInputDialog::setIntStep ( int  step)

Sets the value of the property to step.

void QInputDialog::setIntValue ( int  value)

Sets the value of the property to value.

void QInputDialog::setLabelText ( const QString text)

Sets the value of the property to text.

void QInputDialog::setOkButtonText ( const QString text)

Sets the value of the property to text.

void QInputDialog::setOption ( InputDialogOption  option,
bool  on = true 
)

Sets the given option to be enabled if on is true, otherwise clears the given option.

See also
options, testOption()
void QInputDialog::setOptions ( InputDialogOptions  options)

Sets the value of the property to options.

void QInputDialog::setTextEchoMode ( QLineEdit::EchoMode  mode)

Sets the value of the property to mode.

void QInputDialog::setTextValue ( const QString text)

Sets the value of the property to text.

void QInputDialog::setVisible ( bool  visible)
override

Sets the value of the property to visible.

QSize QInputDialog::sizeHint ( ) const
overridevirtual

Reimplemented from QDialog::sizeHint()

bool QInputDialog::testOption ( InputDialogOption  option) const

Returns true if the given option is enabled, otherwise returns false.

See also
options, setOption()
QLineEdit::EchoMode QInputDialog::textEchoMode ( ) const

Returns the value of the textEchoMode property.

QString QInputDialog::textValue ( ) const

Returns the value of the property.

void QInputDialog::textValueChanged ( const QString text)
signal

This signal is emitted whenever the text string changes in the dialog. The current string is specified by text. The signal is only relevant when the input dialog is used in TextInput mode.

void QInputDialog::textValueSelected ( const QString text)
signal

This signal is emitted whenever the user selects a text string by accepting the dialog; for example, by clicking the OK button. The selected string is specified by text. The signal is only relevant when the input dialog is used in TextInput mode.

Property Documentation

QInputDialog::cancelButtonText

This property holds the text for the button used to cancel the dialog.

PropertiesClass Methods
read cancelButtonText
write setCancelButtonText
QInputDialog::comboBoxEditable

This property holds whether or not the combo box is used in the input dialog is editable.

PropertiesClass Methods
read isComboBoxEditable
write setComboBoxEditable
QInputDialog::comboBoxItems

This property holds the items used in the combobox for the input dialog.

PropertiesClass Methods
read comboBoxItems
write setComboBoxItems
QInputDialog::doubleDecimals

This property holds sets the precision of the double spinbox in decimals.

See also
QDoubleSpinBox::setDecimals()
PropertiesClass Methods
read doubleDecimals
write setDoubleDecimals
QInputDialog::doubleMaximum

This property holds the maximum double precision floating point value accepted as input. This property is only relevant when the input dialog is used in DoubleInput mode.

PropertiesClass Methods
read doubleMaximum
write setDoubleMaximum
QInputDialog::doubleMinimum

This property holds the minimum double precision floating point value accepted as input. This property is only relevant when the input dialog is used in DoubleInput mode.

PropertiesClass Methods
read doubleMinimum
write setDoubleMinimum
QInputDialog::doubleValue

This property holds the current double precision floating point value accepted as input. This property is only relevant when the input dialog is used in DoubleInput mode.

PropertiesClass Methods
read doubleValue
write setDoubleValue
notify doubleValueChanged
QInputDialog::inputMode

This property holds the mode used for input. This property help determines which widget is used for entering input into the dialog.

PropertiesClass Methods
read inputMode
write setInputMode
QInputDialog::intMaximum

This property holds the maximum integer value accepted as input. This property is only relevant when the input dialog is used in IntInput mode.

PropertiesClass Methods
read intMaximum
write setIntMaximum
QInputDialog::intMinimum

This property holds the minimum integer value accepted as input. This property is only relevant when the input dialog is used in IntInput mode.

PropertiesClass Methods
read intMinimum
write setIntMinimum
QInputDialog::intStep

This property holds the step by which the integer value is increased and decreased. This property is only relevant when the input dialog is used in IntInput mode.

PropertiesClass Methods
read intStep
write setIntStep
QInputDialog::intValue

This property holds the current integer value accepted as input. This property is only relevant when the input dialog is used in IntInput mode.

PropertiesClass Methods
read intValue
write setIntValue
notify intValueChanged
QInputDialog::labelText

This property holds the text to for the label to describe what needs to be input.

PropertiesClass Methods
read labelText
write setLabelText
QInputDialog::okButtonText

This property holds the text for the button used to accept the entry in the dialog.

PropertiesClass Methods
read okButtonText
write setOkButtonText
QInputDialog::options

This property holds the various options that affect the look and feel of the dialog. By default, all options are disabled.

See also
setOption(), testOption()
PropertiesClass Methods
read options
write setOptions
QInputDialog::textEchoMode

This property holds the echo mode for the text value. This property is only relevant when the input dialog is used in TextInput mode.

PropertiesClass Methods
read textEchoMode
write setTextEchoMode
QInputDialog::textValue

This property holds the text value for the input dialog. This property is only relevant when the input dialog is used in TextInput mode.

PropertiesClass Methods
read textValue
write setTextValue
notify textValueChanged