| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/dialogs/qinputdialog.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | enum CandidateSignal { | - | ||||||||||||||||||
| 8 | TextValueSelectedSignal, | - | ||||||||||||||||||
| 9 | IntValueSelectedSignal, | - | ||||||||||||||||||
| 10 | DoubleValueSelectedSignal, | - | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | NumCandidateSignals | - | ||||||||||||||||||
| 13 | }; | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | static const char *candidateSignal(int which) | - | ||||||||||||||||||
| 16 | { | - | ||||||||||||||||||
| 17 | switch (CandidateSignal(which)) { | - | ||||||||||||||||||
| 18 | case never executed: TextValueSelectedSignal:case TextValueSelectedSignal:never executed: returncase TextValueSelectedSignal:never executed: qFlagLocation("2""textValueSelected(QString)" "\0" __FILE__ ":" "72");return qFlagLocation("2""textValueSelected(QString)" "\0" __FILE__ ":" "72");never executed: return qFlagLocation("2""textValueSelected(QString)" "\0" __FILE__ ":" "72"); | 0 | ||||||||||||||||||
| 19 | case never executed: IntValueSelectedSignal:case IntValueSelectedSignal:never executed: returncase IntValueSelectedSignal:never executed: qFlagLocation("2""intValueSelected(int)" "\0" __FILE__ ":" "73");return qFlagLocation("2""intValueSelected(int)" "\0" __FILE__ ":" "73");never executed: return qFlagLocation("2""intValueSelected(int)" "\0" __FILE__ ":" "73"); | 0 | ||||||||||||||||||
| 20 | case never executed: DoubleValueSelectedSignal:case DoubleValueSelectedSignal:never executed: returncase DoubleValueSelectedSignal:never executed: qFlagLocation("2""doubleValueSelected(double)" "\0" __FILE__ ":" "74");return qFlagLocation("2""doubleValueSelected(double)" "\0" __FILE__ ":" "74");never executed: return qFlagLocation("2""doubleValueSelected(double)" "\0" __FILE__ ":" "74"); | 0 | ||||||||||||||||||
| 21 | - | |||||||||||||||||||
| 22 | case never executed: NumCandidateSignals:case 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: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||||||||
| 26 | } | - | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | static const char *signalForMember(const char *member) | - | ||||||||||||||||||
| 29 | { | - | ||||||||||||||||||
| 30 | QByteArray normalizedMember(QMetaObject::normalizedSignature(member)); | - | ||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | for (int i = 0; i < NumCandidateSignals
| 0 | ||||||||||||||||||
| 33 | if (QMetaObject::checkConnectArgs(candidateSignal(i), normalizedMember)
| 0 | ||||||||||||||||||
| 34 | return never executed: candidateSignal(i);return candidateSignal(i);never executed: return candidateSignal(i); | 0 | ||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | return never executed: qFlagLocation("2""accepted()" "\0" __FILE__ ":" "91");return 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 | - | |||||||||||||||||||
| 48 | class 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 | - | |||||||||||||||||||
| 56 | public: | - | ||||||||||||||||||
| 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 | - | |||||||||||||||||||
| 63 | public : | - | ||||||||||||||||||
| 64 | void textChanged(bool); | - | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | private : | - | ||||||||||||||||||
| 67 | void notifyTextChanged() { textChanged(hasAcceptableInput()); } never executed: end of block | 0 | ||||||||||||||||||
| 68 | - | |||||||||||||||||||
| 69 | private: | - | ||||||||||||||||||
| 70 | void keyPressEvent(QKeyEvent *event) override { | - | ||||||||||||||||||
| 71 | if ((event->key() == Qt::Key_Return
| 0 | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | setProperty("value", property("value")); | - | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | } never executed: else {end of block | 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 | - | |||||||||||||||||||
| 87 | class 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 | - | |||||||||||||||||||
| 95 | public: | - | ||||||||||||||||||
| 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 | - | |||||||||||||||||||
| 102 | public : | - | ||||||||||||||||||
| 103 | void textChanged(bool); | - | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | private : | - | ||||||||||||||||||
| 106 | void notifyTextChanged() { textChanged(hasAcceptableInput()); } never executed: end of block | 0 | ||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | private: | - | ||||||||||||||||||
| 109 | void keyPressEvent(QKeyEvent *event) override { | - | ||||||||||||||||||
| 110 | if ((event->key() == Qt::Key_Return
| 0 | ||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | setProperty("value", property("value")); | - | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | } never executed: else {end of block | 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 | - | |||||||||||||||||||
| 126 | class 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 | - | |||||||||||||||||||
| 130 | public: | - | ||||||||||||||||||
| 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: comboBox && comboBox->count() > 0;return 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 | - | |||||||||||||||||||
| 168 | QInputDialogPrivate::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 | - | |||||||||||||||||||
| 174 | void QInputDialogPrivate::ensureLayout() | - | ||||||||||||||||||
| 175 | { | - | ||||||||||||||||||
| 176 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | if (mainLayout
| 0 | ||||||||||||||||||
| 179 | return; never executed: return; | 0 | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | if (!inputWidget
| 0 | ||||||||||||||||||
| 182 | ensureLineEdit(); | - | ||||||||||||||||||
| 183 | inputWidget = lineEdit; | - | ||||||||||||||||||
| 184 | } never executed: end of block | 0 | ||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | if (!label
| 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 | - | |||||||||||||||||||
| 207 | void QInputDialogPrivate::ensureLineEdit() | - | ||||||||||||||||||
| 208 | { | - | ||||||||||||||||||
| 209 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 210 | if (!lineEdit
| 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 | - | |||||||||||||||||||
| 221 | void QInputDialogPrivate::ensurePlainTextEdit() | - | ||||||||||||||||||
| 222 | { | - | ||||||||||||||||||
| 223 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 224 | if (!plainTextEdit
| 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 | - | |||||||||||||||||||
| 236 | void QInputDialogPrivate::ensureComboBox() | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 239 | if (!comboBox
| 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 | - | |||||||||||||||||||
| 252 | void QInputDialogPrivate::ensureListView() | - | ||||||||||||||||||
| 253 | { | - | ||||||||||||||||||
| 254 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 255 | if (!listView
| 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 | - | |||||||||||||||||||
| 270 | void QInputDialogPrivate::ensureIntSpinBox() | - | ||||||||||||||||||
| 271 | { | - | ||||||||||||||||||
| 272 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 273 | if (!intSpinBox
| 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 | - | |||||||||||||||||||
| 281 | void QInputDialogPrivate::ensureDoubleSpinBox() | - | ||||||||||||||||||
| 282 | { | - | ||||||||||||||||||
| 283 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 284 | if (!doubleSpinBox
| 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 | - | |||||||||||||||||||
| 292 | void QInputDialogPrivate::ensureEnabledConnection(QAbstractSpinBox *spinBox) | - | ||||||||||||||||||
| 293 | { | - | ||||||||||||||||||
| 294 | if (spinBox
| 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 | - | |||||||||||||||||||
| 300 | void QInputDialogPrivate::setInputWidget(QWidget *widget) | - | ||||||||||||||||||
| 301 | { | - | ||||||||||||||||||
| 302 | ((!(widget)) ? qt_assert("widget",__FILE__,348) : qt_noop()); | - | ||||||||||||||||||
| 303 | if (inputWidget == widget
| 0 | ||||||||||||||||||
| 304 | return; never executed: return; | 0 | ||||||||||||||||||
| 305 | - | |||||||||||||||||||
| 306 | if (mainLayout
| 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)
| 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
| 0 | ||||||||||||||||||
| 329 | lineEdit->setText(textValue); | - | ||||||||||||||||||
| 330 | } never executed: else if (widget == plainTextEditend of block
| 0 | ||||||||||||||||||
| 331 | plainTextEdit->setPlainText(textValue); | - | ||||||||||||||||||
| 332 | } never executed: else if (widget == comboBoxend of block
| 0 | ||||||||||||||||||
| 333 | setComboBoxText(textValue); | - | ||||||||||||||||||
| 334 | } never executed: else if (widget == listViewend of block
| 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 | - | |||||||||||||||||||
| 341 | void QInputDialogPrivate::chooseRightTextInputWidget() | - | ||||||||||||||||||
| 342 | { | - | ||||||||||||||||||
| 343 | QWidget *widget; | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | if (useComboBoxOrListView()
| 0 | ||||||||||||||||||
| 346 | if ((
| 0 | ||||||||||||||||||
| 347 | ensureListView(); | - | ||||||||||||||||||
| 348 | widget = listView; | - | ||||||||||||||||||
| 349 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 350 | widget = comboBox; | - | ||||||||||||||||||
| 351 | } never executed: end of block | 0 | ||||||||||||||||||
| 352 | } else if (opts & QInputDialog::UsePlainTextEditForTextInput
| 0 | ||||||||||||||||||
| 353 | ensurePlainTextEdit(); | - | ||||||||||||||||||
| 354 | widget = plainTextEdit; | - | ||||||||||||||||||
| 355 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 356 | ensureLineEdit(); | - | ||||||||||||||||||
| 357 | widget = lineEdit; | - | ||||||||||||||||||
| 358 | } never executed: end of block | 0 | ||||||||||||||||||
| 359 | - | |||||||||||||||||||
| 360 | setInputWidget(widget); | - | ||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | if (inputWidget == comboBox
| 0 | ||||||||||||||||||
| 363 | _q_textChanged(comboBox->currentText()); | - | ||||||||||||||||||
| 364 | } never executed: else if (inputWidget == listViewend of block
| 0 | ||||||||||||||||||
| 365 | _q_textChanged(listViewText()); | - | ||||||||||||||||||
| 366 | } never executed: end of block | 0 | ||||||||||||||||||
| 367 | } never executed: end of block | 0 | ||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | void QInputDialogPrivate::setComboBoxText(const QString &text) | - | ||||||||||||||||||
| 370 | { | - | ||||||||||||||||||
| 371 | int index = comboBox->findText(text); | - | ||||||||||||||||||
| 372 | if (index != -1
| 0 | ||||||||||||||||||
| 373 | comboBox->setCurrentIndex(index); | - | ||||||||||||||||||
| 374 | } never executed: else if (comboBox->isEditable()end of block
| 0 | ||||||||||||||||||
| 375 | comboBox->setEditText(text); | - | ||||||||||||||||||
| 376 | } never executed: end of block | 0 | ||||||||||||||||||
| 377 | } never executed: end of block | 0 | ||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | void QInputDialogPrivate::setListViewText(const QString &text) | - | ||||||||||||||||||
| 380 | { | - | ||||||||||||||||||
| 381 | int row = comboBox->findText(text); | - | ||||||||||||||||||
| 382 | if (row != -1
| 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 | - | |||||||||||||||||||
| 389 | QString QInputDialogPrivate::listViewText() const | - | ||||||||||||||||||
| 390 | { | - | ||||||||||||||||||
| 391 | if (listView->selectionModel()->hasSelection()
| 0 | ||||||||||||||||||
| 392 | int row = listView->selectionModel()->selectedRows().value(0).row(); | - | ||||||||||||||||||
| 393 | return never executed: comboBox->itemText(row);return comboBox->itemText(row);never executed: return comboBox->itemText(row); | 0 | ||||||||||||||||||
| 394 | } else { | - | ||||||||||||||||||
| 395 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||
| 396 | } | - | ||||||||||||||||||
| 397 | } | - | ||||||||||||||||||
| 398 | - | |||||||||||||||||||
| 399 | void QInputDialogPrivate::_q_textChanged(const QString &text) | - | ||||||||||||||||||
| 400 | { | - | ||||||||||||||||||
| 401 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 402 | if (textValue != text
| 0 | ||||||||||||||||||
| 403 | textValue = text; | - | ||||||||||||||||||
| 404 | q->textValueChanged(text); | - | ||||||||||||||||||
| 405 | } never executed: end of block | 0 | ||||||||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | void QInputDialogPrivate::_q_plainTextEditTextChanged() | - | ||||||||||||||||||
| 409 | { | - | ||||||||||||||||||
| 410 | QInputDialog * const q = q_func(); | - | ||||||||||||||||||
| 411 | QString text = plainTextEdit->toPlainText(); | - | ||||||||||||||||||
| 412 | if (textValue != text
| 0 | ||||||||||||||||||
| 413 | textValue = text; | - | ||||||||||||||||||
| 414 | q->textValueChanged(text); | - | ||||||||||||||||||
| 415 | } never executed: end of block | 0 | ||||||||||||||||||
| 416 | } never executed: end of block | 0 | ||||||||||||||||||
| 417 | - | |||||||||||||||||||
| 418 | void 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 | ||||||||||||||||||
| 424 | QInputDialog::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 | - | |||||||||||||||||||
| 434 | QInputDialog::~QInputDialog() | - | ||||||||||||||||||
| 435 | { | - | ||||||||||||||||||
| 436 | } | - | ||||||||||||||||||
| 437 | void 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: IntInput:case IntInput:never executed: case IntInput: | 0 | ||||||||||||||||||
| 451 | d->ensureIntSpinBox(); | - | ||||||||||||||||||
| 452 | widget = d->intSpinBox; | - | ||||||||||||||||||
| 453 | break; never executed: break; | 0 | ||||||||||||||||||
| 454 | case never executed: DoubleInput:case 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 | - | |||||||||||||||||||
| 467 | QInputDialog::InputMode QInputDialog::inputMode() const | - | ||||||||||||||||||
| 468 | { | - | ||||||||||||||||||
| 469 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 470 | - | |||||||||||||||||||
| 471 | if (d->inputWidget
| 0 | ||||||||||||||||||
| 472 | if (d->inputWidget == d->intSpinBox
| 0 | ||||||||||||||||||
| 473 | return never executed: IntInput;return IntInput;never executed: return IntInput; | 0 | ||||||||||||||||||
| 474 | } else if (d->inputWidget == d->doubleSpinBox
| 0 | ||||||||||||||||||
| 475 | return never executed: DoubleInput;return DoubleInput;never executed: return DoubleInput; | 0 | ||||||||||||||||||
| 476 | } | - | ||||||||||||||||||
| 477 | } never executed: end of block | 0 | ||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | return never executed: TextInput;return TextInput;never executed: return TextInput; | 0 | ||||||||||||||||||
| 480 | } | - | ||||||||||||||||||
| 481 | void QInputDialog::setLabelText(const QString &text) | - | ||||||||||||||||||
| 482 | { | - | ||||||||||||||||||
| 483 | QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 484 | if (!d->label
| 0 | ||||||||||||||||||
| 485 | d->label = new QLabel(text, this); | - | ||||||||||||||||||
| 486 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 487 | d->label->setText(text); | - | ||||||||||||||||||
| 488 | } never executed: end of block | 0 | ||||||||||||||||||
| 489 | } | - | ||||||||||||||||||
| 490 | - | |||||||||||||||||||
| 491 | QString QInputDialog::labelText() const | - | ||||||||||||||||||
| 492 | { | - | ||||||||||||||||||
| 493 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 494 | d->ensureLayout(); | - | ||||||||||||||||||
| 495 | return never executed: d->label->text();return d->label->text();never executed: return d->label->text(); | 0 | ||||||||||||||||||
| 496 | } | - | ||||||||||||||||||
| 497 | void QInputDialog::setOption(InputDialogOption option, bool on) | - | ||||||||||||||||||
| 498 | { | - | ||||||||||||||||||
| 499 | QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 500 | if (!(d->opts & option) != !on
| 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 | - | |||||||||||||||||||
| 510 | bool QInputDialog::testOption(InputDialogOption option) const | - | ||||||||||||||||||
| 511 | { | - | ||||||||||||||||||
| 512 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 513 | return never executed: (d->opts & option) != 0;return (d->opts & option) != 0;never executed: return (d->opts & option) != 0; | 0 | ||||||||||||||||||
| 514 | } | - | ||||||||||||||||||
| 515 | void QInputDialog::setOptions(InputDialogOptions options) | - | ||||||||||||||||||
| 516 | { | - | ||||||||||||||||||
| 517 | QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | InputDialogOptions changed = (options ^ d->opts); | - | ||||||||||||||||||
| 520 | if (!changed
| 0 | ||||||||||||||||||
| 521 | return; never executed: return; | 0 | ||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | d->opts = options; | - | ||||||||||||||||||
| 524 | d->ensureLayout(); | - | ||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | if (changed & NoButtons
| 0 | ||||||||||||||||||
| 527 | d->buttonBox->setVisible(!(options & NoButtons)); never executed: d->buttonBox->setVisible(!(options & NoButtons)); | 0 | ||||||||||||||||||
| 528 | if ((
| 0 | ||||||||||||||||||
| 529 | d->chooseRightTextInputWidget(); never executed: d->chooseRightTextInputWidget(); | 0 | ||||||||||||||||||
| 530 | if ((
| 0 | ||||||||||||||||||
| 531 | d->chooseRightTextInputWidget(); never executed: d->chooseRightTextInputWidget(); | 0 | ||||||||||||||||||
| 532 | } never executed: end of block | 0 | ||||||||||||||||||
| 533 | - | |||||||||||||||||||
| 534 | QInputDialog::InputDialogOptions QInputDialog::options() const | - | ||||||||||||||||||
| 535 | { | - | ||||||||||||||||||
| 536 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 537 | return never executed: d->opts;return d->opts;never executed: return d->opts; | 0 | ||||||||||||||||||
| 538 | } | - | ||||||||||||||||||
| 539 | void QInputDialog::setTextValue(const QString &text) | - | ||||||||||||||||||
| 540 | { | - | ||||||||||||||||||
| 541 | QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 542 | - | |||||||||||||||||||
| 543 | setInputMode(TextInput); | - | ||||||||||||||||||
| 544 | if (d->inputWidget == d->lineEdit
| 0 | ||||||||||||||||||
| 545 | d->lineEdit->setText(text); | - | ||||||||||||||||||
| 546 | } never executed: else if (d->inputWidget == d->plainTextEditend of block
| 0 | ||||||||||||||||||
| 547 | d->plainTextEdit->setPlainText(text); | - | ||||||||||||||||||
| 548 | } never executed: else if (d->inputWidget == d->comboBoxend of block
| 0 | ||||||||||||||||||
| 549 | d->setComboBoxText(text); | - | ||||||||||||||||||
| 550 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 551 | d->setListViewText(text); | - | ||||||||||||||||||
| 552 | } never executed: end of block | 0 | ||||||||||||||||||
| 553 | } | - | ||||||||||||||||||
| 554 | - | |||||||||||||||||||
| 555 | QString QInputDialog::textValue() const | - | ||||||||||||||||||
| 556 | { | - | ||||||||||||||||||
| 557 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 558 | return never executed: d->textValue;return d->textValue;never executed: return d->textValue; | 0 | ||||||||||||||||||
| 559 | } | - | ||||||||||||||||||
| 560 | void 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 | - | |||||||||||||||||||
| 567 | QLineEdit::EchoMode QInputDialog::textEchoMode() const | - | ||||||||||||||||||
| 568 | { | - | ||||||||||||||||||
| 569 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 570 | if (d->lineEdit
| 0 | ||||||||||||||||||
| 571 | return never executed: d->lineEdit->echoMode();return d->lineEdit->echoMode();never executed: return d->lineEdit->echoMode(); | 0 | ||||||||||||||||||
| 572 | } else { | - | ||||||||||||||||||
| 573 | return never executed: QLineEdit::Normal;return QLineEdit::Normal;never executed: return QLineEdit::Normal; | 0 | ||||||||||||||||||
| 574 | } | - | ||||||||||||||||||
| 575 | } | - | ||||||||||||||||||
| 576 | void QInputDialog::setComboBoxEditable(bool editable) | - | ||||||||||||||||||
| 577 | { | - | ||||||||||||||||||
| 578 | QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 579 | d->ensureComboBox(); | - | ||||||||||||||||||
| 580 | d->comboBox->setEditable(editable); | - | ||||||||||||||||||
| 581 | if (inputMode() == TextInput
| 0 | ||||||||||||||||||
| 582 | d->chooseRightTextInputWidget(); never executed: d->chooseRightTextInputWidget(); | 0 | ||||||||||||||||||
| 583 | } never executed: end of block | 0 | ||||||||||||||||||
| 584 | - | |||||||||||||||||||
| 585 | bool QInputDialog::isComboBoxEditable() const | - | ||||||||||||||||||
| 586 | { | - | ||||||||||||||||||
| 587 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 588 | if (d->comboBox
| 0 | ||||||||||||||||||
| 589 | return never executed: d->comboBox->isEditable();return d->comboBox->isEditable();never executed: return d->comboBox->isEditable(); | 0 | ||||||||||||||||||
| 590 | } else { | - | ||||||||||||||||||
| 591 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 592 | } | - | ||||||||||||||||||
| 593 | } | - | ||||||||||||||||||
| 594 | void 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
| 0 | ||||||||||||||||||
| 606 | d->chooseRightTextInputWidget(); never executed: d->chooseRightTextInputWidget(); | 0 | ||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | QStringList QInputDialog::comboBoxItems() const | - | ||||||||||||||||||
| 610 | { | - | ||||||||||||||||||
| 611 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 612 | QStringList result; | - | ||||||||||||||||||
| 613 | if (d->comboBox
| 0 | ||||||||||||||||||
| 614 | const int count = d->comboBox->count(); | - | ||||||||||||||||||
| 615 | result.reserve(count); | - | ||||||||||||||||||
| 616 | for (int i = 0; i < count
| 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: result;return result;never executed: return result; | 0 | ||||||||||||||||||
| 620 | } | - | ||||||||||||||||||
| 621 | void 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 | - | |||||||||||||||||||
| 628 | int QInputDialog::intValue() const | - | ||||||||||||||||||
| 629 | { | - | ||||||||||||||||||
| 630 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 631 | if (d->intSpinBox
| 0 | ||||||||||||||||||
| 632 | return never executed: d->intSpinBox->value();return d->intSpinBox->value();never executed: return d->intSpinBox->value(); | 0 | ||||||||||||||||||
| 633 | } else { | - | ||||||||||||||||||
| 634 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 635 | } | - | ||||||||||||||||||
| 636 | } | - | ||||||||||||||||||
| 637 | void 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 | - | |||||||||||||||||||
| 644 | int QInputDialog::intMinimum() const | - | ||||||||||||||||||
| 645 | { | - | ||||||||||||||||||
| 646 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 647 | if (d->intSpinBox
| 0 | ||||||||||||||||||
| 648 | return never executed: d->intSpinBox->minimum();return d->intSpinBox->minimum();never executed: return d->intSpinBox->minimum(); | 0 | ||||||||||||||||||
| 649 | } else { | - | ||||||||||||||||||
| 650 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 651 | } | - | ||||||||||||||||||
| 652 | } | - | ||||||||||||||||||
| 653 | void 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 | - | |||||||||||||||||||
| 660 | int QInputDialog::intMaximum() const | - | ||||||||||||||||||
| 661 | { | - | ||||||||||||||||||
| 662 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 663 | if (d->intSpinBox
| 0 | ||||||||||||||||||
| 664 | return never executed: d->intSpinBox->maximum();return d->intSpinBox->maximum();never executed: return d->intSpinBox->maximum(); | 0 | ||||||||||||||||||
| 665 | } else { | - | ||||||||||||||||||
| 666 | return never executed: 99;return 99;never executed: return 99; | 0 | ||||||||||||||||||
| 667 | } | - | ||||||||||||||||||
| 668 | } | - | ||||||||||||||||||
| 669 | - | |||||||||||||||||||
| 670 | - | |||||||||||||||||||
| 671 | - | |||||||||||||||||||
| 672 | - | |||||||||||||||||||
| 673 | - | |||||||||||||||||||
| 674 | - | |||||||||||||||||||
| 675 | void 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 | ||||||||||||||||||
| 681 | void 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 | - | |||||||||||||||||||
| 688 | int QInputDialog::intStep() const | - | ||||||||||||||||||
| 689 | { | - | ||||||||||||||||||
| 690 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 691 | if (d->intSpinBox
| 0 | ||||||||||||||||||
| 692 | return never executed: d->intSpinBox->singleStep();return d->intSpinBox->singleStep();never executed: return d->intSpinBox->singleStep(); | 0 | ||||||||||||||||||
| 693 | } else { | - | ||||||||||||||||||
| 694 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 695 | } | - | ||||||||||||||||||
| 696 | } | - | ||||||||||||||||||
| 697 | void 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 | - | |||||||||||||||||||
| 704 | double QInputDialog::doubleValue() const | - | ||||||||||||||||||
| 705 | { | - | ||||||||||||||||||
| 706 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 707 | if (d->doubleSpinBox
| 0 | ||||||||||||||||||
| 708 | return never executed: d->doubleSpinBox->value();return d->doubleSpinBox->value();never executed: return d->doubleSpinBox->value(); | 0 | ||||||||||||||||||
| 709 | } else { | - | ||||||||||||||||||
| 710 | return never executed: 0.0;return 0.0;never executed: return 0.0; | 0 | ||||||||||||||||||
| 711 | } | - | ||||||||||||||||||
| 712 | } | - | ||||||||||||||||||
| 713 | void 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 | - | |||||||||||||||||||
| 720 | double QInputDialog::doubleMinimum() const | - | ||||||||||||||||||
| 721 | { | - | ||||||||||||||||||
| 722 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 723 | if (d->doubleSpinBox
| 0 | ||||||||||||||||||
| 724 | return never executed: d->doubleSpinBox->minimum();return d->doubleSpinBox->minimum();never executed: return d->doubleSpinBox->minimum(); | 0 | ||||||||||||||||||
| 725 | } else { | - | ||||||||||||||||||
| 726 | return never executed: 0.0;return 0.0;never executed: return 0.0; | 0 | ||||||||||||||||||
| 727 | } | - | ||||||||||||||||||
| 728 | } | - | ||||||||||||||||||
| 729 | void 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 | - | |||||||||||||||||||
| 736 | double QInputDialog::doubleMaximum() const | - | ||||||||||||||||||
| 737 | { | - | ||||||||||||||||||
| 738 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 739 | if (d->doubleSpinBox
| 0 | ||||||||||||||||||
| 740 | return never executed: d->doubleSpinBox->maximum();return d->doubleSpinBox->maximum();never executed: return d->doubleSpinBox->maximum(); | 0 | ||||||||||||||||||
| 741 | } else { | - | ||||||||||||||||||
| 742 | return never executed: 99.99;return 99.99;never executed: return 99.99; | 0 | ||||||||||||||||||
| 743 | } | - | ||||||||||||||||||
| 744 | } | - | ||||||||||||||||||
| 745 | - | |||||||||||||||||||
| 746 | - | |||||||||||||||||||
| 747 | - | |||||||||||||||||||
| 748 | - | |||||||||||||||||||
| 749 | - | |||||||||||||||||||
| 750 | - | |||||||||||||||||||
| 751 | void 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 | ||||||||||||||||||
| 757 | void 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 | - | |||||||||||||||||||
| 764 | int QInputDialog::doubleDecimals() const | - | ||||||||||||||||||
| 765 | { | - | ||||||||||||||||||
| 766 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 767 | if (d->doubleSpinBox
| 0 | ||||||||||||||||||
| 768 | return never executed: d->doubleSpinBox->decimals();return d->doubleSpinBox->decimals();never executed: return d->doubleSpinBox->decimals(); | 0 | ||||||||||||||||||
| 769 | } else { | - | ||||||||||||||||||
| 770 | return never executed: 2;return 2;never executed: return 2; | 0 | ||||||||||||||||||
| 771 | } | - | ||||||||||||||||||
| 772 | } | - | ||||||||||||||||||
| 773 | void 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 | - | |||||||||||||||||||
| 780 | QString QInputDialog::okButtonText() const | - | ||||||||||||||||||
| 781 | { | - | ||||||||||||||||||
| 782 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 783 | d->ensureLayout(); | - | ||||||||||||||||||
| 784 | return never executed: d->buttonBox->button(QDialogButtonBox::Ok)->text();return d->buttonBox->button(QDialogButtonBox::Ok)->text();never executed: return d->buttonBox->button(QDialogButtonBox::Ok)->text(); | 0 | ||||||||||||||||||
| 785 | } | - | ||||||||||||||||||
| 786 | - | |||||||||||||||||||
| 787 | - | |||||||||||||||||||
| 788 | - | |||||||||||||||||||
| 789 | - | |||||||||||||||||||
| 790 | - | |||||||||||||||||||
| 791 | - | |||||||||||||||||||
| 792 | - | |||||||||||||||||||
| 793 | void 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 | - | |||||||||||||||||||
| 800 | QString QInputDialog::cancelButtonText() const | - | ||||||||||||||||||
| 801 | { | - | ||||||||||||||||||
| 802 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 803 | d->ensureLayout(); | - | ||||||||||||||||||
| 804 | return never executed: d->buttonBox->button(QDialogButtonBox::Cancel)->text();return d->buttonBox->button(QDialogButtonBox::Cancel)->text();never executed: return d->buttonBox->button(QDialogButtonBox::Cancel)->text(); | 0 | ||||||||||||||||||
| 805 | } | - | ||||||||||||||||||
| 806 | void 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 | - | |||||||||||||||||||
| 818 | QSize QInputDialog::minimumSizeHint() const | - | ||||||||||||||||||
| 819 | { | - | ||||||||||||||||||
| 820 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 821 | d->ensureLayout(); | - | ||||||||||||||||||
| 822 | return never executed: QDialog::minimumSizeHint();return QDialog::minimumSizeHint();never executed: return QDialog::minimumSizeHint(); | 0 | ||||||||||||||||||
| 823 | } | - | ||||||||||||||||||
| 824 | - | |||||||||||||||||||
| 825 | - | |||||||||||||||||||
| 826 | - | |||||||||||||||||||
| 827 | - | |||||||||||||||||||
| 828 | QSize QInputDialog::sizeHint() const | - | ||||||||||||||||||
| 829 | { | - | ||||||||||||||||||
| 830 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 831 | d->ensureLayout(); | - | ||||||||||||||||||
| 832 | return never executed: QDialog::sizeHint();return QDialog::sizeHint();never executed: return QDialog::sizeHint(); | 0 | ||||||||||||||||||
| 833 | } | - | ||||||||||||||||||
| 834 | - | |||||||||||||||||||
| 835 | - | |||||||||||||||||||
| 836 | - | |||||||||||||||||||
| 837 | - | |||||||||||||||||||
| 838 | void QInputDialog::setVisible(bool visible) | - | ||||||||||||||||||
| 839 | { | - | ||||||||||||||||||
| 840 | const QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 841 | if (visible
| 0 | ||||||||||||||||||
| 842 | d->ensureLayout(); | - | ||||||||||||||||||
| 843 | d->inputWidget->setFocus(); | - | ||||||||||||||||||
| 844 | if (d->inputWidget == d->lineEdit
| 0 | ||||||||||||||||||
| 845 | d->lineEdit->selectAll(); | - | ||||||||||||||||||
| 846 | } never executed: else if (d->inputWidget == d->plainTextEditend of block
| 0 | ||||||||||||||||||
| 847 | d->plainTextEdit->selectAll(); | - | ||||||||||||||||||
| 848 | } never executed: else if (d->inputWidget == d->intSpinBoxend of block
| 0 | ||||||||||||||||||
| 849 | d->intSpinBox->selectAll(); | - | ||||||||||||||||||
| 850 | } never executed: else if (d->inputWidget == d->doubleSpinBoxend of block
| 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 | ||||||||||||||||||
| 856 | void QInputDialog::done(int result) | - | ||||||||||||||||||
| 857 | { | - | ||||||||||||||||||
| 858 | QInputDialogPrivate * const d = d_func(); | - | ||||||||||||||||||
| 859 | QDialog::done(result); | - | ||||||||||||||||||
| 860 | if (result
| 0 | ||||||||||||||||||
| 861 | InputMode mode = inputMode(); | - | ||||||||||||||||||
| 862 | switch (mode) { | - | ||||||||||||||||||
| 863 | case never executed: DoubleInput:case DoubleInput:never executed: case DoubleInput: | 0 | ||||||||||||||||||
| 864 | doubleValueSelected(doubleValue()); | - | ||||||||||||||||||
| 865 | break; never executed: break; | 0 | ||||||||||||||||||
| 866 | case never executed: IntInput:case 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
| 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 | ||||||||||||||||||
| 881 | QString 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
| 0 | ||||||||||||||||||
| 894 | * never executed: ok = !!ret;*ok = !!ret;never executed: *ok = !!ret; | 0 | ||||||||||||||||||
| 895 | if (ret
| 0 | ||||||||||||||||||
| 896 | return never executed: dialog.textValue();return dialog.textValue();never executed: return dialog.textValue(); | 0 | ||||||||||||||||||
| 897 | } else { | - | ||||||||||||||||||
| 898 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||
| 899 | } | - | ||||||||||||||||||
| 900 | } | - | ||||||||||||||||||
| 901 | QString 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
| 0 | ||||||||||||||||||
| 914 | * never executed: ok = !!ret;*ok = !!ret;never executed: *ok = !!ret; | 0 | ||||||||||||||||||
| 915 | if (ret
| 0 | ||||||||||||||||||
| 916 | return never executed: dialog.textValue();return dialog.textValue();never executed: return dialog.textValue(); | 0 | ||||||||||||||||||
| 917 | } else { | - | ||||||||||||||||||
| 918 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||
| 919 | } | - | ||||||||||||||||||
| 920 | } | - | ||||||||||||||||||
| 921 | int 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
| 0 | ||||||||||||||||||
| 933 | * never executed: ok = !!ret;*ok = !!ret;never executed: *ok = !!ret; | 0 | ||||||||||||||||||
| 934 | if (ret
| 0 | ||||||||||||||||||
| 935 | return never executed: dialog.intValue();return dialog.intValue();never executed: return dialog.intValue(); | 0 | ||||||||||||||||||
| 936 | } else { | - | ||||||||||||||||||
| 937 | return never executed: value;return value;never executed: return value; | 0 | ||||||||||||||||||
| 938 | } | - | ||||||||||||||||||
| 939 | } | - | ||||||||||||||||||
| 940 | double 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
| 0 | ||||||||||||||||||
| 953 | * never executed: ok = !!ret;*ok = !!ret;never executed: *ok = !!ret; | 0 | ||||||||||||||||||
| 954 | if (ret
| 0 | ||||||||||||||||||
| 955 | return never executed: dialog.doubleValue();return dialog.doubleValue();never executed: return dialog.doubleValue(); | 0 | ||||||||||||||||||
| 956 | } else { | - | ||||||||||||||||||
| 957 | return never executed: value;return value;never executed: return value; | 0 | ||||||||||||||||||
| 958 | } | - | ||||||||||||||||||
| 959 | } | - | ||||||||||||||||||
| 960 | QString 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
| 0 | ||||||||||||||||||
| 976 | * never executed: ok = !!ret;*ok = !!ret;never executed: *ok = !!ret; | 0 | ||||||||||||||||||
| 977 | if (ret
| 0 | ||||||||||||||||||
| 978 | return never executed: dialog.textValue();return dialog.textValue();never executed: return dialog.textValue(); | 0 | ||||||||||||||||||
| 979 | } else { | - | ||||||||||||||||||
| 980 | return never executed: text;return text;never executed: return text; | 0 | ||||||||||||||||||
| 981 | } | - | ||||||||||||||||||
| 982 | } | - | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |