aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickcombobox.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-04-04 16:18:39 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-04-05 07:34:21 +0000
commited64115cbf11a758a9cacd2bd34f3af5603f73b7 (patch)
treeaee8d02bf8503499b579d3521d50728ea2d93c79 /src/quicktemplates2/qquickcombobox.cpp
parent0704f76d4793929b79a1fefd6c9f83ac69e70307 (diff)
Set explicit cursors on all interactive controls
For example, if you have a floating button on top of a text editor, hovering the button must change the cursor from the editor's ibeam cursor to an arrow cursor. This applies to all interactive controls that call setAcceptedMouseButtons(). If a control blocks mouse events, it should not use some random cursor from another control underneath. Task-number: QTBUG-59629 Change-Id: I8a6ae306bbc76a9b22377361cb19cf9c3a872d31 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcombobox.cpp')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 786db55b..85c577b4 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -628,6 +628,9 @@ QQuickComboBox::QQuickComboBox(QQuickItem *parent)
setFocusPolicy(Qt::StrongFocus);
setFlag(QQuickItem::ItemIsFocusScope);
setAcceptedMouseButtons(Qt::LeftButton);
+#if QT_CONFIG(cursor)
+ setCursor(Qt::ArrowCursor);
+#endif
setInputMethodHints(Qt::ImhNoPredictiveText);
}
@@ -737,12 +740,18 @@ void QQuickComboBox::setEditable(bool editable)
QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText);
QObjectPrivate::connect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput);
}
+#if QT_CONFIG(cursor)
+ d->contentItem->setCursor(Qt::IBeamCursor);
+#endif
} else {
d->contentItem->removeEventFilter(this);
if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) {
QObjectPrivate::disconnect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText);
QObjectPrivate::disconnect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput);
}
+#if QT_CONFIG(cursor)
+ d->contentItem->unsetCursor();
+#endif
}
}
@@ -1542,6 +1551,9 @@ void QQuickComboBox::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
connect(newInput, &QQuickTextInput::inputMethodComposingChanged, this, &QQuickComboBox::inputMethodComposingChanged);
connect(newInput, &QQuickTextInput::acceptableInputChanged, this, &QQuickComboBox::acceptableInputChanged);
}
+#if QT_CONFIG(cursor)
+ newItem->setCursor(Qt::IBeamCursor);
+#endif
}
}