qinputdialog.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/dialogs/qinputdialog.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7enum CandidateSignal {-
8 TextValueSelectedSignal,-
9 IntValueSelectedSignal,-
10 DoubleValueSelectedSignal,-
11-
12 NumCandidateSignals-
13};-
14-
15static const char *candidateSignal(int which)-
16{-
17 switch (CandidateSignal(which)) {-
18 case
never executed: case TextValueSelectedSignal:
TextValueSelectedSignal:
never executed: case TextValueSelectedSignal:
return
never executed: return qFlagLocation("2""textValueSelected(QString)" "\0" __FILE__ ":" "72");
qFlagLocation("2""textValueSelected(QString)" "\0" __FILE__ ":" "72");
never executed: return qFlagLocation("2""textValueSelected(QString)" "\0" __FILE__ ":" "72");
0
19 case
never executed: case IntValueSelectedSignal:
IntValueSelectedSignal:
never executed: case IntValueSelectedSignal:
return
never executed: return qFlagLocation("2""intValueSelected(int)" "\0" __FILE__ ":" "73");
qFlagLocation("2""intValueSelected(int)" "\0" __FILE__ ":" "73");
never executed: return qFlagLocation("2""intValueSelected(int)" "\0" __FILE__ ":" "73");
0
20 case
never executed: case DoubleValueSelectedSignal:
DoubleValueSelectedSignal:
never executed: case DoubleValueSelectedSignal:
return
never executed: return qFlagLocation("2""doubleValueSelected(double)" "\0" __FILE__ ":" "74");
qFlagLocation("2""doubleValueSelected(double)" "\0" __FILE__ ":" "74");
never executed: return qFlagLocation("2""doubleValueSelected(double)" "\0" __FILE__ ":" "74");
0
21-
22 case
never executed: case NumCandidateSignals:
NumCandidateSignals:
never executed: case NumCandidateSignals:
;
0
23 }
never executed: end of block
;
0
24 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,78) : qt_noop()); __builtin_unreachable(); } while (0);-
25 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
26}-
27-
28static const char *signalForMember(const char *member)-
29{-
30 QByteArray normalizedMember(QMetaObject::normalizedSignature(member));-
31-
32 for (int i = 0; i < NumCandidateSignals
i < NumCandidateSignalsDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
33 if (QMetaObject::checkConnectArgs(candidateSignal(i), normalizedMember)
QMetaObject::c...malizedMember)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
34 return
never executed: return candidateSignal(i);
candidateSignal(i);
never executed: return candidateSignal(i);
0
35-
36-
37 return
never executed: return qFlagLocation("2""accepted()" "\0" __FILE__ ":" "91");
qFlagLocation("2""accepted()" "\0" __FILE__ ":" "91");
never executed: return qFlagLocation("2""accepted()" "\0" __FILE__ ":" "91");
0
38}-
39-
40-
41-
42-
43-
44-
45-
46-
47-
48class QInputDialogSpinBox : public QSpinBox-
49{-
50 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
51#pragma GCC diagnostic push-
52 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
53#pragma GCC diagnostic pop-
54 struct QPrivateSignal {};-
55-
56public:-
57 QInputDialogSpinBox(QWidget *parent)-
58 : QSpinBox(parent) {-
59 connect(lineEdit(), qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "109"), this, qFlagLocation("1""notifyTextChanged()" "\0" __FILE__ ":" "109"));-
60 connect(this, qFlagLocation("2""editingFinished()" "\0" __FILE__ ":" "110"), this, qFlagLocation("1""notifyTextChanged()" "\0" __FILE__ ":" "110"));-
61 }
never executed: end of block
0
62-
63public :-
64 void textChanged(bool);-
65-
66private :-
67 void notifyTextChanged() { textChanged(hasAcceptableInput()); }
never executed: end of block
0
68-
69private:-
70 void keyPressEvent(QKeyEvent *event) override {-
71 if ((event->key() == Qt::Key_Return
event->key() == Qt::Key_ReturnDescription
TRUEnever evaluated
FALSEnever evaluated
|| event->key() == Qt::Key_Enter
event->key() == Qt::Key_EnterDescription
TRUEnever evaluated
FALSEnever evaluated
) && !hasAcceptableInput()
!hasAcceptableInput()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
72-
73 setProperty("value", property("value"));-
74-
75 }
never executed: end of block
else {
0
76 QSpinBox::keyPressEvent(event);-
77 }
never executed: end of block
0
78 notifyTextChanged();-
79 }
never executed: end of block
0
80-
81 void mousePressEvent(QMouseEvent *event) override {-
82 QSpinBox::mousePressEvent(event);-
83 notifyTextChanged();-
84 }
never executed: end of block
0
85};-
86-
87class QInputDialogDoubleSpinBox : public QDoubleSpinBox-
88{-
89 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
90#pragma GCC diagnostic push-
91 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
92#pragma GCC diagnostic pop-
93 struct QPrivateSignal {};-
94-
95public:-
96 QInputDialogDoubleSpinBox(QWidget *parent = 0)-
97 : QDoubleSpinBox(parent) {-
98 connect(lineEdit(), qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "144"), this, qFlagLocation("1""notifyTextChanged()" "\0" __FILE__ ":" "144"));-
99 connect(this, qFlagLocation("2""editingFinished()" "\0" __FILE__ ":" "145"), this, qFlagLocation("1""notifyTextChanged()" "\0" __FILE__ ":" "145"));-
100 }
never executed: end of block
0
101-
102public :-
103 void textChanged(bool);-
104-
105private :-
106 void notifyTextChanged() { textChanged(hasAcceptableInput()); }
never executed: end of block
0
107-
108private:-
109 void keyPressEvent(QKeyEvent *event) override {-
110 if ((event->key() == Qt::Key_Return
event->key() == Qt::Key_ReturnDescription
TRUEnever evaluated
FALSEnever evaluated
|| event->key() == Qt::Key_Enter
event->key() == Qt::Key_EnterDescription
TRUEnever evaluated
FALSEnever evaluated
) && !hasAcceptableInput()
!hasAcceptableInput()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
111-
112 setProperty("value", property("value"));-
113-
114 }
never executed: end of block
else {
0
115 QDoubleSpinBox::keyPressEvent(event);-
116 }
never executed: end of block
0
117 notifyTextChanged();-
118 }
never executed: end of block
0
119-
120 void mousePressEvent(QMouseEvent *event) override {-
121 QDoubleSpinBox::mousePressEvent(event);-
122 notifyTextChanged();-
123 }
never executed: end of block
0
124};-
125-
126class QInputDialogPrivate : public QDialogPrivate-
127{-
128 inline QInputDialog* q_func() { return static_cast<QInputDialog *>(q_ptr); } inline const QInputDialog* q_func() const { return static_cast<const QInputDialog *>(q_ptr); } friend class QInputDialog;-
129-
130public:-
131 QInputDialogPrivate();-
132-
133 void ensureLayout();-
134 void ensureLineEdit();-
135 void ensurePlainTextEdit();-
136 void ensureComboBox();-
137 void ensureListView();-
138 void ensureIntSpinBox();-
139 void ensureDoubleSpinBox();-
140 void ensureEnabledConnection(QAbstractSpinBox *spinBox);-
141 void setInputWidget(QWidget *widget);-
142 void chooseRightTextInputWidget();-
143 void setComboBoxText(const QString &text);-
144 void setListViewText(const QString &text);-
145 QString listViewText() const;-
146 void ensureLayout() const { const_cast<QInputDialogPrivate *>(this)->ensureLayout(); }
never executed: end of block
0
147 bool useComboBoxOrListView() const { return
never executed: return comboBox && comboBox->count() > 0;
comboBox && comboBox->count() > 0;
never executed: return comboBox && comboBox->count() > 0;
}
0
148 void _q_textChanged(const QString &text);-
149 void _q_plainTextEditTextChanged();-
150 void _q_currentRowChanged(const QModelIndex &newIndex, const QModelIndex &oldIndex);-
151-
152 mutable QLabel *label;-
153 mutable QDialogButtonBox *buttonBox;-
154 mutable QLineEdit *lineEdit;-
155 mutable QPlainTextEdit *plainTextEdit;-
156 mutable QSpinBox *intSpinBox;-
157 mutable QDoubleSpinBox *doubleSpinBox;-
158 mutable QComboBox *comboBox;-
159 mutable QListView *listView;-
160 mutable QWidget *inputWidget;-
161 mutable QVBoxLayout *mainLayout;-
162 QInputDialog::InputDialogOptions opts;-
163 QString textValue;-
164 QPointer<QObject> receiverToDisconnectOnClose;-
165 QByteArray memberToDisconnectOnClose;-
166};-
167-
168QInputDialogPrivate::QInputDialogPrivate()-
169 : label(0), buttonBox(0), lineEdit(0), plainTextEdit(0), intSpinBox(0), doubleSpinBox(0),-
170 comboBox(0), listView(0), inputWidget(0), mainLayout(0)-
171{-
172}
never executed: end of block
0
173-
174void QInputDialogPrivate::ensureLayout()-
175{-
176 QInputDialog * const q = q_func();-
177-
178 if (mainLayout
mainLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
179 return;
never executed: return;
0
180-
181 if (!inputWidget
!inputWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
182 ensureLineEdit();-
183 inputWidget = lineEdit;-
184 }
never executed: end of block
0
185-
186 if (!label
!labelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
187 label = new QLabel(QInputDialog::tr("Enter a value:"), q);
never executed: label = new QLabel(QInputDialog::tr("Enter a value:"), q);
0
188-
189 label->setBuddy(inputWidget);-
190-
191 label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);-
192-
193 buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, q);-
194 QObject::connect(buttonBox, qFlagLocation("2""accepted()" "\0" __FILE__ ":" "240"), q, qFlagLocation("1""accept()" "\0" __FILE__ ":" "240"));-
195 QObject::connect(buttonBox, qFlagLocation("2""rejected()" "\0" __FILE__ ":" "241"), q, qFlagLocation("1""reject()" "\0" __FILE__ ":" "241"));-
196-
197 mainLayout = new QVBoxLayout(q);-
198-
199 mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);-
200 mainLayout->addWidget(label);-
201 mainLayout->addWidget(inputWidget);-
202 mainLayout->addWidget(buttonBox);-
203 ensureEnabledConnection(qobject_cast<QAbstractSpinBox *>(inputWidget));-
204 inputWidget->show();-
205}
never executed: end of block
0
206-
207void QInputDialogPrivate::ensureLineEdit()-
208{-
209 QInputDialog * const q = q_func();-
210 if (!lineEdit
!lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
211 lineEdit = new QLineEdit(q);-
212-
213 qt_widget_private(lineEdit)->inheritsInputMethodHints = 1;-
214-
215 lineEdit->hide();-
216 QObject::connect(lineEdit, qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "262"),-
217 q, qFlagLocation("1""_q_textChanged(QString)" "\0" __FILE__ ":" "263"));-
218 }
never executed: end of block
0
219}
never executed: end of block
0
220-
221void QInputDialogPrivate::ensurePlainTextEdit()-
222{-
223 QInputDialog * const q = q_func();-
224 if (!plainTextEdit
!plainTextEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
225 plainTextEdit = new QPlainTextEdit(q);-
226 plainTextEdit->setLineWrapMode(QPlainTextEdit::NoWrap);-
227-
228 qt_widget_private(plainTextEdit)->inheritsInputMethodHints = 1;-
229-
230 plainTextEdit->hide();-
231 QObject::connect(plainTextEdit, qFlagLocation("2""textChanged()" "\0" __FILE__ ":" "277"),-
232 q, qFlagLocation("1""_q_plainTextEditTextChanged()" "\0" __FILE__ ":" "278"));-
233 }
never executed: end of block
0
234}
never executed: end of block
0
235-
236void QInputDialogPrivate::ensureComboBox()-
237{-
238 QInputDialog * const q = q_func();-
239 if (!comboBox
!comboBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
240 comboBox = new QComboBox(q);-
241-
242 qt_widget_private(comboBox)->inheritsInputMethodHints = 1;-
243-
244 comboBox->hide();-
245 QObject::connect(comboBox, qFlagLocation("2""editTextChanged(QString)" "\0" __FILE__ ":" "291"),-
246 q, qFlagLocation("1""_q_textChanged(QString)" "\0" __FILE__ ":" "292"));-
247 QObject::connect(comboBox, qFlagLocation("2""currentIndexChanged(QString)" "\0" __FILE__ ":" "293"),-
248 q, qFlagLocation("1""_q_textChanged(QString)" "\0" __FILE__ ":" "294"));-
249 }
never executed: end of block
0
250}
never executed: end of block
0
251-
252void QInputDialogPrivate::ensureListView()-
253{-
254 QInputDialog * const q = q_func();-
255 if (!listView
!listViewDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
256 ensureComboBox();-
257-
258 listView = new QListView(q);-
259 listView->hide();-
260 listView->setEditTriggers(QAbstractItemView::NoEditTriggers);-
261 listView->setSelectionMode(QAbstractItemView::SingleSelection);-
262 listView->setModel(comboBox->model());-
263 listView->setCurrentIndex(QModelIndex());-
264 QObject::connect(listView->selectionModel(),-
265 qFlagLocation("2""currentRowChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "311"),-
266 q, qFlagLocation("1""_q_currentRowChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "312"));-
267 }
never executed: end of block
0
268}
never executed: end of block
0
269-
270void QInputDialogPrivate::ensureIntSpinBox()-
271{-
272 QInputDialog * const q = q_func();-
273 if (!intSpinBox
!intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
274 intSpinBox = new QInputDialogSpinBox(q);-
275 intSpinBox->hide();-
276 QObject::connect(intSpinBox, qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "322"),-
277 q, qFlagLocation("2""intValueChanged(int)" "\0" __FILE__ ":" "323"));-
278 }
never executed: end of block
0
279}
never executed: end of block
0
280-
281void QInputDialogPrivate::ensureDoubleSpinBox()-
282{-
283 QInputDialog * const q = q_func();-
284 if (!doubleSpinBox
!doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
285 doubleSpinBox = new QInputDialogDoubleSpinBox(q);-
286 doubleSpinBox->hide();-
287 QObject::connect(doubleSpinBox, qFlagLocation("2""valueChanged(double)" "\0" __FILE__ ":" "333"),-
288 q, qFlagLocation("2""doubleValueChanged(double)" "\0" __FILE__ ":" "334"));-
289 }
never executed: end of block
0
290}
never executed: end of block
0
291-
292void QInputDialogPrivate::ensureEnabledConnection(QAbstractSpinBox *spinBox)-
293{-
294 if (spinBox
spinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
295 QAbstractButton *okButton = buttonBox->button(QDialogButtonBox::Ok);-
296 QObject::connect(spinBox, qFlagLocation("2""textChanged(bool)" "\0" __FILE__ ":" "342"), okButton, qFlagLocation("1""setEnabled(bool)" "\0" __FILE__ ":" "342"), Qt::UniqueConnection);-
297 }
never executed: end of block
0
298}
never executed: end of block
0
299-
300void QInputDialogPrivate::setInputWidget(QWidget *widget)-
301{-
302 ((!(widget)) ? qt_assert("widget",__FILE__,348) : qt_noop());-
303 if (inputWidget == widget
inputWidget == widgetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
304 return;
never executed: return;
0
305-
306 if (mainLayout
mainLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
307 ((!(inputWidget)) ? qt_assert("inputWidget",__FILE__,353) : qt_noop());-
308 mainLayout->removeWidget(inputWidget);-
309 inputWidget->hide();-
310 mainLayout->insertWidget(1, widget);-
311 widget->show();-
312-
313-
314 QAbstractButton *okButton = buttonBox->button(QDialogButtonBox::Ok);-
315 if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(inputWidget)
QAbstractSpinB...>(inputWidget)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
316 QObject::disconnect(spinBox, qFlagLocation("2""textChanged(bool)" "\0" __FILE__ ":" "362"), okButton, qFlagLocation("1""setEnabled(bool)" "\0" __FILE__ ":" "362"));
never executed: QObject::disconnect(spinBox, qFlagLocation("2""textChanged(bool)" "\0" __FILE__ ":" "362"), okButton, qFlagLocation("1""setEnabled(bool)" "\0" __FILE__ ":" "362"));
0
317-
318-
319 QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(widget);-
320 ensureEnabledConnection(spinBox);-
321 okButton->setEnabled(!spinBox || spinBox->hasAcceptableInput());-
322 }
never executed: end of block
0
323-
324 inputWidget = widget;-
325-
326-
327-
328 if (widget == lineEdit
widget == lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
329 lineEdit->setText(textValue);-
330 }
never executed: end of block
else if (widget == plainTextEdit
widget == plainTextEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
331 plainTextEdit->setPlainText(textValue);-
332 }
never executed: end of block
else if (widget == comboBox
widget == comboBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
333 setComboBoxText(textValue);-
334 }
never executed: end of block
else if (widget == listView
widget == listViewDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
335 setListViewText(textValue);-
336 ensureLayout();-
337 buttonBox->button(QDialogButtonBox::Ok)->setEnabled(listView->selectionModel()->hasSelection());-
338 }
never executed: end of block
0
339}
never executed: end of block
0
340-
341void QInputDialogPrivate::chooseRightTextInputWidget()-
342{-
343 QWidget *widget;-
344-
345 if (useComboBoxOrListView()
useComboBoxOrListView()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
346 if ((
(opts & QInput...ComboBoxItems)Description
TRUEnever evaluated
FALSEnever evaluated
opts & QInputDialog::UseListViewForComboBoxItems)
(opts & QInput...ComboBoxItems)Description
TRUEnever evaluated
FALSEnever evaluated
&& !comboBox->isEditable()
!comboBox->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
347 ensureListView();-
348 widget = listView;-
349 }
never executed: end of block
else {
0
350 widget = comboBox;-
351 }
never executed: end of block
0
352 } else if (opts & QInputDialog::UsePlainTextEditForTextInput
opts & QInputD...itForTextInputDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
353 ensurePlainTextEdit();-
354 widget = plainTextEdit;-
355 }
never executed: end of block
else {
0
356 ensureLineEdit();-
357 widget = lineEdit;-
358 }
never executed: end of block
0
359-
360 setInputWidget(widget);-
361-
362 if (inputWidget == comboBox
inputWidget == comboBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
363 _q_textChanged(comboBox->currentText());-
364 }
never executed: end of block
else if (inputWidget == listView
inputWidget == listViewDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
365 _q_textChanged(listViewText());-
366 }
never executed: end of block
0
367}
never executed: end of block
0
368-
369void QInputDialogPrivate::setComboBoxText(const QString &text)-
370{-
371 int index = comboBox->findText(text);-
372 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
373 comboBox->setCurrentIndex(index);-
374 }
never executed: end of block
else if (comboBox->isEditable()
comboBox->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
375 comboBox->setEditText(text);-
376 }
never executed: end of block
0
377}
never executed: end of block
0
378-
379void QInputDialogPrivate::setListViewText(const QString &text)-
380{-
381 int row = comboBox->findText(text);-
382 if (row != -1
row != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
383 QModelIndex index(comboBox->model()->index(row, 0));-
384 listView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear-
385 | QItemSelectionModel::SelectCurrent);-
386 }
never executed: end of block
0
387}
never executed: end of block
0
388-
389QString QInputDialogPrivate::listViewText() const-
390{-
391 if (listView->selectionModel()->hasSelection()
listView->sele...hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
392 int row = listView->selectionModel()->selectedRows().value(0).row();-
393 return
never executed: return comboBox->itemText(row);
comboBox->itemText(row);
never executed: return comboBox->itemText(row);
0
394 } else {-
395 return
never executed: return QString();
QString();
never executed: return QString();
0
396 }-
397}-
398-
399void QInputDialogPrivate::_q_textChanged(const QString &text)-
400{-
401 QInputDialog * const q = q_func();-
402 if (textValue != text
textValue != textDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
403 textValue = text;-
404 q->textValueChanged(text);-
405 }
never executed: end of block
0
406}
never executed: end of block
0
407-
408void QInputDialogPrivate::_q_plainTextEditTextChanged()-
409{-
410 QInputDialog * const q = q_func();-
411 QString text = plainTextEdit->toPlainText();-
412 if (textValue != text
textValue != textDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
413 textValue = text;-
414 q->textValueChanged(text);-
415 }
never executed: end of block
0
416}
never executed: end of block
0
417-
418void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex,-
419 const QModelIndex & )-
420{-
421 _q_textChanged(comboBox->model()->data(newIndex).toString());-
422 buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);-
423}
never executed: end of block
0
424QInputDialog::QInputDialog(QWidget *parent, Qt::WindowFlags flags)-
425 : QDialog(*new QInputDialogPrivate, parent, flags)-
426{-
427}
never executed: end of block
0
428-
429-
430-
431-
432-
433-
434QInputDialog::~QInputDialog()-
435{-
436}-
437void QInputDialog::setInputMode(InputMode mode)-
438{-
439 QInputDialogPrivate * const d = d_func();-
440-
441 QWidget *widget;-
442-
443-
444-
445-
446-
447-
448-
449 switch (mode) {-
450 case
never executed: case IntInput:
IntInput:
never executed: case IntInput:
0
451 d->ensureIntSpinBox();-
452 widget = d->intSpinBox;-
453 break;
never executed: break;
0
454 case
never executed: case DoubleInput:
DoubleInput:
never executed: case DoubleInput:
0
455 d->ensureDoubleSpinBox();-
456 widget = d->doubleSpinBox;-
457 break;
never executed: break;
0
458 default
never executed: default:
:
never executed: default:
0
459 ((!(mode == TextInput)) ? qt_assert("mode == TextInput",__FILE__,564) : qt_noop());-
460 d->chooseRightTextInputWidget();-
461 return;
never executed: return;
0
462 }-
463-
464 d->setInputWidget(widget);-
465}
never executed: end of block
0
466-
467QInputDialog::InputMode QInputDialog::inputMode() const-
468{-
469 const QInputDialogPrivate * const d = d_func();-
470-
471 if (d->inputWidget
d->inputWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
472 if (d->inputWidget == d->intSpinBox
d->inputWidget... d->intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
473 return
never executed: return IntInput;
IntInput;
never executed: return IntInput;
0
474 } else if (d->inputWidget == d->doubleSpinBox
d->inputWidget...>doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
475 return
never executed: return DoubleInput;
DoubleInput;
never executed: return DoubleInput;
0
476 }-
477 }
never executed: end of block
0
478-
479 return
never executed: return TextInput;
TextInput;
never executed: return TextInput;
0
480}-
481void QInputDialog::setLabelText(const QString &text)-
482{-
483 QInputDialogPrivate * const d = d_func();-
484 if (!d->label
!d->labelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
485 d->label = new QLabel(text, this);-
486 }
never executed: end of block
else {
0
487 d->label->setText(text);-
488 }
never executed: end of block
0
489}-
490-
491QString QInputDialog::labelText() const-
492{-
493 const QInputDialogPrivate * const d = d_func();-
494 d->ensureLayout();-
495 return
never executed: return d->label->text();
d->label->text();
never executed: return d->label->text();
0
496}-
497void QInputDialog::setOption(InputDialogOption option, bool on)-
498{-
499 QInputDialogPrivate * const d = d_func();-
500 if (!(d->opts & option) != !on
!(d->opts & option) != !onDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
501 setOptions(d->opts ^ option);
never executed: setOptions(d->opts ^ option);
0
502}
never executed: end of block
0
503-
504-
505-
506-
507-
508-
509-
510bool QInputDialog::testOption(InputDialogOption option) const-
511{-
512 const QInputDialogPrivate * const d = d_func();-
513 return
never executed: return (d->opts & option) != 0;
(d->opts & option) != 0;
never executed: return (d->opts & option) != 0;
0
514}-
515void QInputDialog::setOptions(InputDialogOptions options)-
516{-
517 QInputDialogPrivate * const d = d_func();-
518-
519 InputDialogOptions changed = (options ^ d->opts);-
520 if (!changed
!changedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
521 return;
never executed: return;
0
522-
523 d->opts = options;-
524 d->ensureLayout();-
525-
526 if (changed & NoButtons
changed & NoButtonsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
527 d->buttonBox->setVisible(!(options & NoButtons));
never executed: d->buttonBox->setVisible(!(options & NoButtons));
0
528 if ((
(changed & Use...ComboBoxItems)Description
TRUEnever evaluated
FALSEnever evaluated
changed & UseListViewForComboBoxItems)
(changed & Use...ComboBoxItems)Description
TRUEnever evaluated
FALSEnever evaluated
&& inputMode() == TextInput
inputMode() == TextInputDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
529 d->chooseRightTextInputWidget();
never executed: d->chooseRightTextInputWidget();
0
530 if ((
(changed & Use...tForTextInput)Description
TRUEnever evaluated
FALSEnever evaluated
changed & UsePlainTextEditForTextInput)
(changed & Use...tForTextInput)Description
TRUEnever evaluated
FALSEnever evaluated
&& inputMode() == TextInput
inputMode() == TextInputDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
531 d->chooseRightTextInputWidget();
never executed: d->chooseRightTextInputWidget();
0
532}
never executed: end of block
0
533-
534QInputDialog::InputDialogOptions QInputDialog::options() const-
535{-
536 const QInputDialogPrivate * const d = d_func();-
537 return
never executed: return d->opts;
d->opts;
never executed: return d->opts;
0
538}-
539void QInputDialog::setTextValue(const QString &text)-
540{-
541 QInputDialogPrivate * const d = d_func();-
542-
543 setInputMode(TextInput);-
544 if (d->inputWidget == d->lineEdit
d->inputWidget == d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
545 d->lineEdit->setText(text);-
546 }
never executed: end of block
else if (d->inputWidget == d->plainTextEdit
d->inputWidget...>plainTextEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
547 d->plainTextEdit->setPlainText(text);-
548 }
never executed: end of block
else if (d->inputWidget == d->comboBox
d->inputWidget == d->comboBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
549 d->setComboBoxText(text);-
550 }
never executed: end of block
else {
0
551 d->setListViewText(text);-
552 }
never executed: end of block
0
553}-
554-
555QString QInputDialog::textValue() const-
556{-
557 const QInputDialogPrivate * const d = d_func();-
558 return
never executed: return d->textValue;
d->textValue;
never executed: return d->textValue;
0
559}-
560void QInputDialog::setTextEchoMode(QLineEdit::EchoMode mode)-
561{-
562 QInputDialogPrivate * const d = d_func();-
563 d->ensureLineEdit();-
564 d->lineEdit->setEchoMode(mode);-
565}
never executed: end of block
0
566-
567QLineEdit::EchoMode QInputDialog::textEchoMode() const-
568{-
569 const QInputDialogPrivate * const d = d_func();-
570 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
571 return
never executed: return d->lineEdit->echoMode();
d->lineEdit->echoMode();
never executed: return d->lineEdit->echoMode();
0
572 } else {-
573 return
never executed: return QLineEdit::Normal;
QLineEdit::Normal;
never executed: return QLineEdit::Normal;
0
574 }-
575}-
576void QInputDialog::setComboBoxEditable(bool editable)-
577{-
578 QInputDialogPrivate * const d = d_func();-
579 d->ensureComboBox();-
580 d->comboBox->setEditable(editable);-
581 if (inputMode() == TextInput
inputMode() == TextInputDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
582 d->chooseRightTextInputWidget();
never executed: d->chooseRightTextInputWidget();
0
583}
never executed: end of block
0
584-
585bool QInputDialog::isComboBoxEditable() const-
586{-
587 const QInputDialogPrivate * const d = d_func();-
588 if (d->comboBox
d->comboBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
589 return
never executed: return d->comboBox->isEditable();
d->comboBox->isEditable();
never executed: return d->comboBox->isEditable();
0
590 } else {-
591 return
never executed: return false;
false;
never executed: return false;
0
592 }-
593}-
594void QInputDialog::setComboBoxItems(const QStringList &items)-
595{-
596 QInputDialogPrivate * const d = d_func();-
597-
598 d->ensureComboBox();-
599 {-
600 const QSignalBlocker blocker(d->comboBox);-
601 d->comboBox->clear();-
602 d->comboBox->addItems(items);-
603 }-
604-
605 if (inputMode() == TextInput
inputMode() == TextInputDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
606 d->chooseRightTextInputWidget();
never executed: d->chooseRightTextInputWidget();
0
607}
never executed: end of block
0
608-
609QStringList QInputDialog::comboBoxItems() const-
610{-
611 const QInputDialogPrivate * const d = d_func();-
612 QStringList result;-
613 if (d->comboBox
d->comboBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
614 const int count = d->comboBox->count();-
615 result.reserve(count);-
616 for (int i = 0; i < count
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
617 result.append(d->comboBox->itemText(i));
never executed: result.append(d->comboBox->itemText(i));
0
618 }
never executed: end of block
0
619 return
never executed: return result;
result;
never executed: return result;
0
620}-
621void QInputDialog::setIntValue(int value)-
622{-
623 QInputDialogPrivate * const d = d_func();-
624 setInputMode(IntInput);-
625 d->intSpinBox->setValue(value);-
626}
never executed: end of block
0
627-
628int QInputDialog::intValue() const-
629{-
630 const QInputDialogPrivate * const d = d_func();-
631 if (d->intSpinBox
d->intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
632 return
never executed: return d->intSpinBox->value();
d->intSpinBox->value();
never executed: return d->intSpinBox->value();
0
633 } else {-
634 return
never executed: return 0;
0;
never executed: return 0;
0
635 }-
636}-
637void QInputDialog::setIntMinimum(int min)-
638{-
639 QInputDialogPrivate * const d = d_func();-
640 d->ensureIntSpinBox();-
641 d->intSpinBox->setMinimum(min);-
642}
never executed: end of block
0
643-
644int QInputDialog::intMinimum() const-
645{-
646 const QInputDialogPrivate * const d = d_func();-
647 if (d->intSpinBox
d->intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
648 return
never executed: return d->intSpinBox->minimum();
d->intSpinBox->minimum();
never executed: return d->intSpinBox->minimum();
0
649 } else {-
650 return
never executed: return 0;
0;
never executed: return 0;
0
651 }-
652}-
653void QInputDialog::setIntMaximum(int max)-
654{-
655 QInputDialogPrivate * const d = d_func();-
656 d->ensureIntSpinBox();-
657 d->intSpinBox->setMaximum(max);-
658}
never executed: end of block
0
659-
660int QInputDialog::intMaximum() const-
661{-
662 const QInputDialogPrivate * const d = d_func();-
663 if (d->intSpinBox
d->intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
664 return
never executed: return d->intSpinBox->maximum();
d->intSpinBox->maximum();
never executed: return d->intSpinBox->maximum();
0
665 } else {-
666 return
never executed: return 99;
99;
never executed: return 99;
0
667 }-
668}-
669-
670-
671-
672-
673-
674-
675void QInputDialog::setIntRange(int min, int max)-
676{-
677 QInputDialogPrivate * const d = d_func();-
678 d->ensureIntSpinBox();-
679 d->intSpinBox->setRange(min, max);-
680}
never executed: end of block
0
681void QInputDialog::setIntStep(int step)-
682{-
683 QInputDialogPrivate * const d = d_func();-
684 d->ensureIntSpinBox();-
685 d->intSpinBox->setSingleStep(step);-
686}
never executed: end of block
0
687-
688int QInputDialog::intStep() const-
689{-
690 const QInputDialogPrivate * const d = d_func();-
691 if (d->intSpinBox
d->intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
692 return
never executed: return d->intSpinBox->singleStep();
d->intSpinBox->singleStep();
never executed: return d->intSpinBox->singleStep();
0
693 } else {-
694 return
never executed: return 1;
1;
never executed: return 1;
0
695 }-
696}-
697void QInputDialog::setDoubleValue(double value)-
698{-
699 QInputDialogPrivate * const d = d_func();-
700 setInputMode(DoubleInput);-
701 d->doubleSpinBox->setValue(value);-
702}
never executed: end of block
0
703-
704double QInputDialog::doubleValue() const-
705{-
706 const QInputDialogPrivate * const d = d_func();-
707 if (d->doubleSpinBox
d->doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
708 return
never executed: return d->doubleSpinBox->value();
d->doubleSpinBox->value();
never executed: return d->doubleSpinBox->value();
0
709 } else {-
710 return
never executed: return 0.0;
0.0;
never executed: return 0.0;
0
711 }-
712}-
713void QInputDialog::setDoubleMinimum(double min)-
714{-
715 QInputDialogPrivate * const d = d_func();-
716 d->ensureDoubleSpinBox();-
717 d->doubleSpinBox->setMinimum(min);-
718}
never executed: end of block
0
719-
720double QInputDialog::doubleMinimum() const-
721{-
722 const QInputDialogPrivate * const d = d_func();-
723 if (d->doubleSpinBox
d->doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
724 return
never executed: return d->doubleSpinBox->minimum();
d->doubleSpinBox->minimum();
never executed: return d->doubleSpinBox->minimum();
0
725 } else {-
726 return
never executed: return 0.0;
0.0;
never executed: return 0.0;
0
727 }-
728}-
729void QInputDialog::setDoubleMaximum(double max)-
730{-
731 QInputDialogPrivate * const d = d_func();-
732 d->ensureDoubleSpinBox();-
733 d->doubleSpinBox->setMaximum(max);-
734}
never executed: end of block
0
735-
736double QInputDialog::doubleMaximum() const-
737{-
738 const QInputDialogPrivate * const d = d_func();-
739 if (d->doubleSpinBox
d->doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
740 return
never executed: return d->doubleSpinBox->maximum();
d->doubleSpinBox->maximum();
never executed: return d->doubleSpinBox->maximum();
0
741 } else {-
742 return
never executed: return 99.99;
99.99;
never executed: return 99.99;
0
743 }-
744}-
745-
746-
747-
748-
749-
750-
751void QInputDialog::setDoubleRange(double min, double max)-
752{-
753 QInputDialogPrivate * const d = d_func();-
754 d->ensureDoubleSpinBox();-
755 d->doubleSpinBox->setRange(min, max);-
756}
never executed: end of block
0
757void QInputDialog::setDoubleDecimals(int decimals)-
758{-
759 QInputDialogPrivate * const d = d_func();-
760 d->ensureDoubleSpinBox();-
761 d->doubleSpinBox->setDecimals(decimals);-
762}
never executed: end of block
0
763-
764int QInputDialog::doubleDecimals() const-
765{-
766 const QInputDialogPrivate * const d = d_func();-
767 if (d->doubleSpinBox
d->doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
768 return
never executed: return d->doubleSpinBox->decimals();
d->doubleSpinBox->decimals();
never executed: return d->doubleSpinBox->decimals();
0
769 } else {-
770 return
never executed: return 2;
2;
never executed: return 2;
0
771 }-
772}-
773void QInputDialog::setOkButtonText(const QString &text)-
774{-
775 const QInputDialogPrivate * const d = d_func();-
776 d->ensureLayout();-
777 d->buttonBox->button(QDialogButtonBox::Ok)->setText(text);-
778}
never executed: end of block
0
779-
780QString QInputDialog::okButtonText() const-
781{-
782 const QInputDialogPrivate * const d = d_func();-
783 d->ensureLayout();-
784 return
never executed: return d->buttonBox->button(QDialogButtonBox::Ok)->text();
d->buttonBox->button(QDialogButtonBox::Ok)->text();
never executed: return d->buttonBox->button(QDialogButtonBox::Ok)->text();
0
785}-
786-
787-
788-
789-
790-
791-
792-
793void QInputDialog::setCancelButtonText(const QString &text)-
794{-
795 const QInputDialogPrivate * const d = d_func();-
796 d->ensureLayout();-
797 d->buttonBox->button(QDialogButtonBox::Cancel)->setText(text);-
798}
never executed: end of block
0
799-
800QString QInputDialog::cancelButtonText() const-
801{-
802 const QInputDialogPrivate * const d = d_func();-
803 d->ensureLayout();-
804 return
never executed: return d->buttonBox->button(QDialogButtonBox::Cancel)->text();
d->buttonBox->button(QDialogButtonBox::Cancel)->text();
never executed: return d->buttonBox->button(QDialogButtonBox::Cancel)->text();
0
805}-
806void QInputDialog::open(QObject *receiver, const char *member)-
807{-
808 QInputDialogPrivate * const d = d_func();-
809 connect(this, signalForMember(member), receiver, member);-
810 d->receiverToDisconnectOnClose = receiver;-
811 d->memberToDisconnectOnClose = member;-
812 QDialog::open();-
813}
never executed: end of block
0
814-
815-
816-
817-
818QSize QInputDialog::minimumSizeHint() const-
819{-
820 const QInputDialogPrivate * const d = d_func();-
821 d->ensureLayout();-
822 return
never executed: return QDialog::minimumSizeHint();
QDialog::minimumSizeHint();
never executed: return QDialog::minimumSizeHint();
0
823}-
824-
825-
826-
827-
828QSize QInputDialog::sizeHint() const-
829{-
830 const QInputDialogPrivate * const d = d_func();-
831 d->ensureLayout();-
832 return
never executed: return QDialog::sizeHint();
QDialog::sizeHint();
never executed: return QDialog::sizeHint();
0
833}-
834-
835-
836-
837-
838void QInputDialog::setVisible(bool visible)-
839{-
840 const QInputDialogPrivate * const d = d_func();-
841 if (visible
visibleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
842 d->ensureLayout();-
843 d->inputWidget->setFocus();-
844 if (d->inputWidget == d->lineEdit
d->inputWidget == d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
845 d->lineEdit->selectAll();-
846 }
never executed: end of block
else if (d->inputWidget == d->plainTextEdit
d->inputWidget...>plainTextEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
847 d->plainTextEdit->selectAll();-
848 }
never executed: end of block
else if (d->inputWidget == d->intSpinBox
d->inputWidget... d->intSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
849 d->intSpinBox->selectAll();-
850 }
never executed: end of block
else if (d->inputWidget == d->doubleSpinBox
d->inputWidget...>doubleSpinBoxDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
851 d->doubleSpinBox->selectAll();-
852 }
never executed: end of block
0
853 }
never executed: end of block
0
854 QDialog::setVisible(visible);-
855}
never executed: end of block
0
856void QInputDialog::done(int result)-
857{-
858 QInputDialogPrivate * const d = d_func();-
859 QDialog::done(result);-
860 if (result
resultDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
861 InputMode mode = inputMode();-
862 switch (mode) {-
863 case
never executed: case DoubleInput:
DoubleInput:
never executed: case DoubleInput:
0
864 doubleValueSelected(doubleValue());-
865 break;
never executed: break;
0
866 case
never executed: case IntInput:
IntInput:
never executed: case IntInput:
0
867 intValueSelected(intValue());-
868 break;
never executed: break;
0
869 default
never executed: default:
:
never executed: default:
0
870 ((!(mode == TextInput)) ? qt_assert("mode == TextInput",__FILE__,1162) : qt_noop());-
871 textValueSelected(textValue());-
872 }
never executed: end of block
0
873 }-
874 if (d->receiverToDisconnectOnClose
d->receiverToDisconnectOnCloseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
875 disconnect(this, signalForMember(d->memberToDisconnectOnClose),-
876 d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);-
877 d->receiverToDisconnectOnClose = 0;-
878 }
never executed: end of block
0
879 d->memberToDisconnectOnClose.clear();-
880}
never executed: end of block
0
881QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label,-
882 QLineEdit::EchoMode mode, const QString &text, bool *ok,-
883 Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)-
884{-
885 QInputDialog dialog(parent, flags);-
886 dialog.setWindowTitle(title);-
887 dialog.setLabelText(label);-
888 dialog.setTextValue(text);-
889 dialog.setTextEchoMode(mode);-
890 dialog.setInputMethodHints(inputMethodHints);-
891-
892 int ret = dialog.exec();-
893 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
894 *
never executed: *ok = !!ret;
ok = !!ret;
never executed: *ok = !!ret;
0
895 if (ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
896 return
never executed: return dialog.textValue();
dialog.textValue();
never executed: return dialog.textValue();
0
897 } else {-
898 return
never executed: return QString();
QString();
never executed: return QString();
0
899 }-
900}-
901QString QInputDialog::getMultiLineText(QWidget *parent, const QString &title, const QString &label,-
902 const QString &text, bool *ok, Qt::WindowFlags flags,-
903 Qt::InputMethodHints inputMethodHints)-
904{-
905 QInputDialog dialog(parent, flags);-
906 dialog.setOptions(QInputDialog::UsePlainTextEditForTextInput);-
907 dialog.setWindowTitle(title);-
908 dialog.setLabelText(label);-
909 dialog.setTextValue(text);-
910 dialog.setInputMethodHints(inputMethodHints);-
911-
912 int ret = dialog.exec();-
913 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
914 *
never executed: *ok = !!ret;
ok = !!ret;
never executed: *ok = !!ret;
0
915 if (ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
916 return
never executed: return dialog.textValue();
dialog.textValue();
never executed: return dialog.textValue();
0
917 } else {-
918 return
never executed: return QString();
QString();
never executed: return QString();
0
919 }-
920}-
921int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &label, int value,-
922 int min, int max, int step, bool *ok, Qt::WindowFlags flags)-
923{-
924 QInputDialog dialog(parent, flags);-
925 dialog.setWindowTitle(title);-
926 dialog.setLabelText(label);-
927 dialog.setIntRange(min, max);-
928 dialog.setIntValue(value);-
929 dialog.setIntStep(step);-
930-
931 int ret = dialog.exec();-
932 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
933 *
never executed: *ok = !!ret;
ok = !!ret;
never executed: *ok = !!ret;
0
934 if (ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
935 return
never executed: return dialog.intValue();
dialog.intValue();
never executed: return dialog.intValue();
0
936 } else {-
937 return
never executed: return value;
value;
never executed: return value;
0
938 }-
939}-
940double QInputDialog::getDouble(QWidget *parent, const QString &title, const QString &label,-
941 double value, double min, double max, int decimals, bool *ok,-
942 Qt::WindowFlags flags)-
943{-
944 QInputDialog dialog(parent, flags);-
945 dialog.setWindowTitle(title);-
946 dialog.setLabelText(label);-
947 dialog.setDoubleDecimals(decimals);-
948 dialog.setDoubleRange(min, max);-
949 dialog.setDoubleValue(value);-
950-
951 int ret = dialog.exec();-
952 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
953 *
never executed: *ok = !!ret;
ok = !!ret;
never executed: *ok = !!ret;
0
954 if (ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
955 return
never executed: return dialog.doubleValue();
dialog.doubleValue();
never executed: return dialog.doubleValue();
0
956 } else {-
957 return
never executed: return value;
value;
never executed: return value;
0
958 }-
959}-
960QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label,-
961 const QStringList &items, int current, bool editable, bool *ok,-
962 Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)-
963{-
964 QString text(items.value(current));-
965-
966 QInputDialog dialog(parent, flags);-
967 dialog.setWindowTitle(title);-
968 dialog.setLabelText(label);-
969 dialog.setComboBoxItems(items);-
970 dialog.setTextValue(text);-
971 dialog.setComboBoxEditable(editable);-
972 dialog.setInputMethodHints(inputMethodHints);-
973-
974 int ret = dialog.exec();-
975 if (ok
okDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
976 *
never executed: *ok = !!ret;
ok = !!ret;
never executed: *ok = !!ret;
0
977 if (ret
retDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
978 return
never executed: return dialog.textValue();
dialog.textValue();
never executed: return dialog.textValue();
0
979 } else {-
980 return
never executed: return text;
text;
never executed: return text;
0
981 }-
982}-
983-
984-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9