aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp25
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h8
2 files changed, 33 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 199e3408..79ee6663 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -293,6 +293,7 @@ public:
bool editable = false;
bool accepting = false;
bool allowComplete = false;
+ bool selectTextByMouse = false;
Qt::InputMethodHints inputMethodHints = Qt::ImhNone;
QString editText;
QValidator *validator = nullptr;
@@ -1568,6 +1569,30 @@ int QQuickComboBox::indexOfValue(const QVariant &value) const
}
/*!
+ \since QtQuick.Controls 2.15 (Qt 5.15)
+ \qmlproperty bool QtQuick.Controls::ComboBox::selectTextByMouse
+
+ This property holds whether the text field for an editable ComboBox
+ can be selected with the mouse.
+
+ The default value is \c false.
+*/
+bool QQuickComboBox::selectTextByMouse() const
+{
+ Q_D(const QQuickComboBox);
+ return d->extra.isAllocated() ? d->extra->selectTextByMouse : false;
+}
+
+void QQuickComboBox::setSelectTextByMouse(bool canSelect)
+{
+ Q_D(QQuickComboBox);
+ if (canSelect == selectTextByMouse())
+ return;
+
+ d->extra.value().selectTextByMouse = canSelect;
+ emit selectTextByMouseChanged();
+}
+/*!
\qmlmethod string QtQuick.Controls::ComboBox::textAt(int index)
Returns the text for the specified \a index, or an empty string
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index 00bc1242..b52d7545 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -92,6 +92,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl
// 2.14 (Qt 5.14)
Q_PROPERTY(QVariant currentValue READ currentValue NOTIFY currentValueChanged FINAL REVISION 14)
Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole NOTIFY valueRoleChanged FINAL REVISION 14)
+ // 2.15 (Qt 5.15)
+ Q_PROPERTY(bool selectTextByMouse READ selectTextByMouse WRITE setSelectTextByMouse NOTIFY selectTextByMouseChanged FINAL REVISION 15)
public:
explicit QQuickComboBox(QQuickItem *parent = nullptr);
@@ -169,6 +171,10 @@ public:
Q_REVISION(14) Q_INVOKABLE QVariant valueAt(int index) const;
Q_REVISION(14) Q_INVOKABLE int indexOfValue(const QVariant &value) const;
+ // 2.15 (Qt 5.15)
+ bool selectTextByMouse() const;
+ void setSelectTextByMouse(bool canSelect);
+
public Q_SLOTS:
void incrementCurrentIndex();
void decrementCurrentIndex();
@@ -206,6 +212,8 @@ Q_SIGNALS:
// 2.14 (Qt 5.14)
Q_REVISION(14) void valueRoleChanged();
Q_REVISION(14) void currentValueChanged();
+ // 2.15 (Qt 5.15)
+ Q_REVISION(15) void selectTextByMouseChanged();
protected:
bool eventFilter(QObject *object, QEvent *event) override;