Warning, file /include/QtWidgets/qinputdialog.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QINPUTDIALOG_H
0005 #define QINPUTDIALOG_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/qstring.h>
0009 #include <QtWidgets/qlineedit.h>
0010
0011 #include <QtWidgets/qdialog.h>
0012
0013 QT_REQUIRE_CONFIG(inputdialog);
0014
0015 QT_BEGIN_NAMESPACE
0016
0017 class QInputDialogPrivate;
0018
0019 class Q_WIDGETS_EXPORT QInputDialog : public QDialog
0020 {
0021 Q_OBJECT
0022 Q_DECLARE_PRIVATE(QInputDialog)
0023 QDOC_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode)
0024 QDOC_PROPERTY(QString labelText READ labelText WRITE setLabelText)
0025 QDOC_PROPERTY(InputDialogOptions options READ options WRITE setOptions)
0026 QDOC_PROPERTY(QString textValue READ textValue WRITE setTextValue NOTIFY textValueChanged)
0027 QDOC_PROPERTY(int intValue READ intValue WRITE setIntValue NOTIFY intValueChanged)
0028 QDOC_PROPERTY(int doubleValue READ doubleValue WRITE setDoubleValue NOTIFY doubleValueChanged)
0029 QDOC_PROPERTY(QLineEdit::EchoMode textEchoMode READ textEchoMode WRITE setTextEchoMode)
0030 QDOC_PROPERTY(bool comboBoxEditable READ isComboBoxEditable WRITE setComboBoxEditable)
0031 QDOC_PROPERTY(QStringList comboBoxItems READ comboBoxItems WRITE setComboBoxItems)
0032 QDOC_PROPERTY(int intMinimum READ intMinimum WRITE setIntMinimum)
0033 QDOC_PROPERTY(int intMaximum READ intMaximum WRITE setIntMaximum)
0034 QDOC_PROPERTY(int intStep READ intStep WRITE setIntStep)
0035 QDOC_PROPERTY(double doubleMinimum READ doubleMinimum WRITE setDoubleMinimum)
0036 QDOC_PROPERTY(double doubleMaximum READ doubleMaximum WRITE setDoubleMaximum)
0037 QDOC_PROPERTY(int doubleDecimals READ doubleDecimals WRITE setDoubleDecimals)
0038 QDOC_PROPERTY(QString okButtonText READ okButtonText WRITE setOkButtonText)
0039 QDOC_PROPERTY(QString cancelButtonText READ cancelButtonText WRITE setCancelButtonText)
0040 QDOC_PROPERTY(double doubleStep READ doubleStep WRITE setDoubleStep)
0041
0042 public:
0043 enum InputDialogOption {
0044 NoButtons = 0x00000001,
0045 UseListViewForComboBoxItems = 0x00000002,
0046 UsePlainTextEditForTextInput = 0x00000004
0047 };
0048
0049 Q_DECLARE_FLAGS(InputDialogOptions, InputDialogOption)
0050
0051 enum InputMode {
0052 TextInput,
0053 IntInput,
0054 DoubleInput
0055 };
0056
0057 QInputDialog(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
0058 ~QInputDialog();
0059
0060 void setInputMode(InputMode mode);
0061 InputMode inputMode() const;
0062
0063 void setLabelText(const QString &text);
0064 QString labelText() const;
0065
0066 void setOption(InputDialogOption option, bool on = true);
0067 bool testOption(InputDialogOption option) const;
0068 void setOptions(InputDialogOptions options);
0069 InputDialogOptions options() const;
0070
0071 void setTextValue(const QString &text);
0072 QString textValue() const;
0073
0074 void setTextEchoMode(QLineEdit::EchoMode mode);
0075 QLineEdit::EchoMode textEchoMode() const;
0076
0077 void setComboBoxEditable(bool editable);
0078 bool isComboBoxEditable() const;
0079
0080 void setComboBoxItems(const QStringList &items);
0081 QStringList comboBoxItems() const;
0082
0083 void setIntValue(int value);
0084 int intValue() const;
0085
0086 void setIntMinimum(int min);
0087 int intMinimum() const;
0088
0089 void setIntMaximum(int max);
0090 int intMaximum() const;
0091
0092 void setIntRange(int min, int max);
0093
0094 void setIntStep(int step);
0095 int intStep() const;
0096
0097 void setDoubleValue(double value);
0098 double doubleValue() const;
0099
0100 void setDoubleMinimum(double min);
0101 double doubleMinimum() const;
0102
0103 void setDoubleMaximum(double max);
0104 double doubleMaximum() const;
0105
0106 void setDoubleRange(double min, double max);
0107
0108 void setDoubleDecimals(int decimals);
0109 int doubleDecimals() const;
0110
0111 void setOkButtonText(const QString &text);
0112 QString okButtonText() const;
0113
0114 void setCancelButtonText(const QString &text);
0115 QString cancelButtonText() const;
0116
0117 using QDialog::open;
0118 void open(QObject *receiver, const char *member);
0119
0120 QSize minimumSizeHint() const override;
0121 QSize sizeHint() const override;
0122
0123 void setVisible(bool visible) override;
0124
0125 static QString getText(QWidget *parent, const QString &title, const QString &label,
0126 QLineEdit::EchoMode echo = QLineEdit::Normal,
0127 const QString &text = QString(), bool *ok = nullptr,
0128 Qt::WindowFlags flags = Qt::WindowFlags(),
0129 Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
0130 static QString getMultiLineText(QWidget *parent, const QString &title, const QString &label,
0131 const QString &text = QString(), bool *ok = nullptr,
0132 Qt::WindowFlags flags = Qt::WindowFlags(),
0133 Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
0134 static QString getItem(QWidget *parent, const QString &title, const QString &label,
0135 const QStringList &items, int current = 0, bool editable = true,
0136 bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(),
0137 Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
0138
0139 static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0,
0140 int minValue = -2147483647, int maxValue = 2147483647,
0141 int step = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
0142
0143 static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0,
0144 double minValue = -2147483647, double maxValue = 2147483647,
0145 int decimals = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(),
0146 double step = 1);
0147
0148 void setDoubleStep(double step);
0149 double doubleStep() const;
0150
0151 Q_SIGNALS:
0152 void textValueChanged(const QString &text);
0153 void textValueSelected(const QString &text);
0154 void intValueChanged(int value);
0155 void intValueSelected(int value);
0156 void doubleValueChanged(double value);
0157 void doubleValueSelected(double value);
0158
0159 public:
0160 void done(int result) override;
0161
0162 private:
0163 Q_DISABLE_COPY(QInputDialog)
0164 };
0165
0166 Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions)
0167
0168 QT_END_NAMESPACE
0169
0170 #endif