diff options
Diffstat (limited to 'src/quicktemplates2/qquickcombobox.cpp')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 67 |
1 files changed, 21 insertions, 46 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index d4280b30..d018be44 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -187,7 +187,7 @@ public: QString stringValue(int index, const QString &role) override; private: - QQuickComboBox *combo; + QQuickComboBox *combo = nullptr; }; QQuickComboBoxDelegateModel::QQuickComboBoxDelegateModel(QQuickComboBox *combo) @@ -220,8 +220,6 @@ class QQuickComboBoxPrivate : public QQuickControlPrivate Q_DECLARE_PUBLIC(QQuickComboBox) public: - QQuickComboBoxPrivate(); - bool isPopupVisible() const; void showPopup(); void hidePopup(bool accept); @@ -266,62 +264,37 @@ public: void itemImplicitWidthChanged(QQuickItem *item) override; void itemImplicitHeightChanged(QQuickItem *item) override; - bool flat; - bool down; - bool hasDown; - bool pressed; - bool ownModel; - bool keyNavigating; - bool hasDisplayText; - bool hasCurrentIndex; - int highlightedIndex; - int currentIndex; + bool flat = false; + bool down = false; + bool hasDown = false; + bool pressed = false; + bool ownModel = false; + bool keyNavigating = false; + bool hasDisplayText = false; + bool hasCurrentIndex = false; + int highlightedIndex = -1; + int currentIndex = -1; QVariant model; QString textRole; QString currentText; QString displayText; - QQuickItem *pressedItem; - QQmlInstanceModel *delegateModel; - QQmlComponent *delegate; + QQuickItem *pressedItem = nullptr; + QQmlInstanceModel *delegateModel = nullptr; + QQmlComponent *delegate = nullptr; QQuickDeferredPointer<QQuickItem> indicator; QQuickDeferredPointer<QQuickPopup> popup; struct ExtraData { - ExtraData() - : editable(false), - accepting(false), - allowComplete(false), - inputMethodHints(Qt::ImhNone), - validator(nullptr) { } - - bool editable; - bool accepting; - bool allowComplete; - Qt::InputMethodHints inputMethodHints; + bool editable = false; + bool accepting = false; + bool allowComplete = false; + Qt::InputMethodHints inputMethodHints = Qt::ImhNone; QString editText; - QValidator *validator; + QValidator *validator = nullptr; }; QLazilyAllocated<ExtraData> extra; }; -QQuickComboBoxPrivate::QQuickComboBoxPrivate() - : flat(false), - down(false), - hasDown(false), - pressed(false), - ownModel(false), - keyNavigating(false), - hasDisplayText(false), - hasCurrentIndex(false), - highlightedIndex(-1), - currentIndex(-1), - delegateModel(nullptr), - delegate(nullptr), - indicator(nullptr), - popup(nullptr) -{ -} - bool QQuickComboBoxPrivate::isPopupVisible() const { return popup && popup->isVisible(); @@ -920,6 +893,8 @@ int QQuickComboBox::highlightedIndex() const This property holds the index of the current item in the combo box. + The default value is \c -1 when \l count is \c 0, and \c 0 otherwise. + \sa activated(), currentText, highlightedIndex */ int QQuickComboBox::currentIndex() const |