21#include <QtCore/qpointer.h>
43 Q_UNREACHABLE_RETURN(
nullptr);
74 this, &QInputDialogSpinBox::notifyTextChanged);
76 this, &QInputDialogSpinBox::notifyTextChanged);
109 this, &QInputDialogDoubleSpinBox::notifyTextChanged);
111 this, &QInputDialogDoubleSpinBox::notifyTextChanged);
184 QInputDialog::InputDialogOptions
opts;
209 label =
new QLabel(QInputDialog::tr(
"Enter a value:"),
q);
210#ifndef QT_NO_SHORTCUT
530 d->ensureIntSpinBox();
534 d->ensureDoubleSpinBox();
539 d->chooseRightTextInputWidget();
550 if (
d->inputWidget) {
551 if (
d->inputWidget ==
d->intSpinBox) {
553 }
else if (
d->inputWidget ==
d->doubleSpinBox) {
574 d->label->setText(
text);
582 return d->label->text();
611 if (!(
d->opts &
option) != !on)
624 return (
d->opts &
option) != 0;
640 InputDialogOptions changed = (
options ^
d->opts);
650 d->chooseRightTextInputWidget();
652 d->chooseRightTextInputWidget();
676 if (
d->inputWidget ==
d->lineEdit) {
677 d->lineEdit->setText(
text);
678 }
else if (
d->inputWidget ==
d->plainTextEdit) {
679 d->plainTextEdit->setPlainText(
text);
680 }
else if (
d->inputWidget ==
d->comboBox) {
681 d->setComboBoxText(
text);
683 d->setListViewText(
text);
707 d->lineEdit->setEchoMode(
mode);
714 return d->lineEdit->echoMode();
731 d->comboBox->setEditable(editable);
733 d->chooseRightTextInputWidget();
740 return d->comboBox->isEditable();
760 d->comboBox->clear();
761 d->comboBox->addItems(
items);
765 d->chooseRightTextInputWidget();
773 const int count =
d->comboBox->count();
776 result.append(
d->comboBox->itemText(
i));
793 d->intSpinBox->setValue(
value);
800 return d->intSpinBox->value();
817 d->ensureIntSpinBox();
818 d->intSpinBox->setMinimum(min);
825 return d->intSpinBox->minimum();
842 d->ensureIntSpinBox();
843 d->intSpinBox->setMaximum(max);
850 return d->intSpinBox->maximum();
864 d->ensureIntSpinBox();
865 d->intSpinBox->setRange(min, max);
879 d->ensureIntSpinBox();
880 d->intSpinBox->setSingleStep(step);
887 return d->intSpinBox->singleStep();
905 d->doubleSpinBox->setValue(
value);
911 if (
d->doubleSpinBox) {
912 return d->doubleSpinBox->value();
929 d->ensureDoubleSpinBox();
930 d->doubleSpinBox->setMinimum(min);
936 if (
d->doubleSpinBox) {
937 return d->doubleSpinBox->minimum();
954 d->ensureDoubleSpinBox();
955 d->doubleSpinBox->setMaximum(max);
961 if (
d->doubleSpinBox) {
962 return d->doubleSpinBox->maximum();
976 d->ensureDoubleSpinBox();
977 d->doubleSpinBox->setRange(min, max);
992 d->ensureDoubleSpinBox();
993 d->doubleSpinBox->setDecimals(decimals);
999 if (
d->doubleSpinBox) {
1000 return d->doubleSpinBox->decimals();
1067 d->receiverToDisconnectOnClose = receiver;
1068 d->memberToDisconnectOnClose = member;
1100 d->inputWidget->setFocus();
1101 if (
d->inputWidget ==
d->lineEdit) {
1102 d->lineEdit->selectAll();
1103 }
else if (
d->inputWidget ==
d->plainTextEdit) {
1104 d->plainTextEdit->selectAll();
1105 }
else if (
d->inputWidget ==
d->intSpinBox) {
1106 d->intSpinBox->selectAll();
1107 }
else if (
d->inputWidget ==
d->doubleSpinBox) {
1108 d->doubleSpinBox->selectAll();
1139 if (
d->receiverToDisconnectOnClose) {
1141 d->receiverToDisconnectOnClose,
d->memberToDisconnectOnClose);
1142 d->receiverToDisconnectOnClose =
nullptr;
1144 d->memberToDisconnectOnClose.clear();
1175 Qt::WindowFlags
flags, Qt::InputMethodHints inputMethodHints)
1188 return dialog->textValue();
1223 Qt::InputMethodHints inputMethodHints)
1236 return dialog->textValue();
1270 int min,
int max,
int step,
bool *
ok, Qt::WindowFlags
flags)
1275 dialog->setIntRange(min, max);
1277 dialog->setIntStep(step);
1283 return dialog->intValue();
1317 double value,
double min,
double max,
int decimals,
bool *
ok,
1318 Qt::WindowFlags
flags,
double step)
1323 dialog->setDoubleDecimals(decimals);
1324 dialog->setDoubleRange(min, max);
1326 dialog->setDoubleStep(step);
1332 return dialog->doubleValue();
1369 Qt::WindowFlags
flags, Qt::InputMethodHints inputMethodHints)
1378 dialog->setComboBoxEditable(editable);
1385 return dialog->textValue();
1403 d->ensureDoubleSpinBox();
1404 d->doubleSpinBox->setSingleStep(step);
1410 if (
d->doubleSpinBox)
1411 return d->doubleSpinBox->singleStep();
1481#include "qinputdialog.moc"
1482#include "moc_qinputdialog.cpp"
virtual Q_INVOKABLE QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
Returns the data stored under the given role for the item referred to by the index.
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index.
void setEditTriggers(EditTriggers triggers)
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
virtual void setModel(QAbstractItemModel *model)
Sets the model for the view to present.
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const override
\reimp
QItemSelectionModel * selectionModel() const
Returns the current selection model.
void setSelectionMode(QAbstractItemView::SelectionMode mode)
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
void editingFinished()
This signal is emitted editing is finished.
QLineEdit * lineEdit() const
This function returns a pointer to the line edit of the spin box.
bool hasAcceptableInput() const
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
void insertWidget(int index, QWidget *widget, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Inserts widget at position index, with stretch factor stretch and alignment alignment.
The QComboBox widget combines a button with a dropdown list.
QString itemText(int index) const
Returns the text for the given index in the combobox.
int count
the number of items in the combobox.
void editTextChanged(const QString &)
This signal is emitted when the text in the combobox's line edit widget is changed.
void currentTextChanged(const QString &)
QString currentText
the current text
void setEditText(const QString &text)
Sets the text in the combobox's text edit.
QAbstractItemModel * model() const
Returns the model used by the combobox.
int findText(const QString &text, Qt::MatchFlags flags=static_cast< Qt::MatchFlags >(Qt::MatchExactly|Qt::MatchCaseSensitive)) const
Returns the index of the item containing the given text; otherwise returns -1.
void setCurrentIndex(int index)
The QDialog class is the base class of dialog windows.
QSize sizeHint() const override
\reimp
virtual void reject()
Hides the modal dialog and sets the result code to Rejected.
virtual int exec()
Shows the dialog as a \l{QDialog::Modal Dialogs}{modal dialog}, blocking until the user closes it.
QSize minimumSizeHint() const override
\reimp
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
virtual void done(int)
Closes the dialog and sets its result code to r.
void setVisible(bool visible) override
\reimp
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
The QDoubleSpinBox class provides a spin box widget that takes doubles.
void valueChanged(double)
This signal is emitted whenever the spin box's value is changed.
void setLabelText(DialogLabel label, const QString &text)
Sets the text shown in the filedialog in the specified label.
void setOptions(Options options)
Q_INVOKABLE QModelIndexList selectedRows(int column=0) const
virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
void currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous)
This signal is emitted if the current item changes and its row is different to the row of the previou...
The QKeyEvent class describes a key event.
The QLabel widget provides a text or image display.
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
void setSizeConstraint(SizeConstraint)
The QLineEdit widget is a one-line text editor.
void textChanged(const QString &)
This signal is emitted whenever the text changes.
void setText(const QString &)
EchoMode
This enum type describes how a line edit should display its contents.
The QListView class provides a list or icon view onto a model.
T value(qsizetype i) const
constexpr int row() const noexcept
Returns the row this model index refers to.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
The QPlainTextEdit class provides a widget that is used to edit and display plain text.
void setLineWrapMode(LineWrapMode mode)
void setPlainText(const QString &text)
Changes the text of the text edit to the string text.
QString toPlainText() const
Returns the text of the text edit as plain text.
void textChanged()
This signal is emitted whenever the document's content changes; for example, when text is inserted or...
Exception-safe wrapper around QObject::blockSignals().
The QSpinBox class provides a spin box widget.
void valueChanged(int)
This signal is emitted whenever the spin box's value is changed.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QVBoxLayout class lines up widgets vertically.
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLenum GLsizei count
GLuint GLsizei const GLchar * label
[43]
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
myObject disconnect()
[26]
QFileDialog dialog(this)
[1]
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)