diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-10-22 16:57:10 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-10-24 11:52:39 +0200 |
commit | 7f99de60294c24242afca3d456691fe6290aaeb5 (patch) | |
tree | df199b1c338bed2d670396f8e5392fa4acbbbc48 | |
parent | e748ad35b5a8574287d93d9110bbbed3ab6a593e (diff) |
SplitView: fix cursor shape staying as Split*Cursor in some cases
Don't return early before restoring the ArrowCursor shape.
This is not testable in QML due to QWindow's cursor API not being
available there.
Task-number: QTBUG-79302
Change-Id: Idb59d9cfbf04fc12ebe0adfbb7285ae7155e195d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r-- | src/quicktemplates2/qquicksplitview.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/quicktemplates2/qquicksplitview.cpp b/src/quicktemplates2/qquicksplitview.cpp index 108dbe07..b131aa25 100644 --- a/src/quicktemplates2/qquicksplitview.cpp +++ b/src/quicktemplates2/qquicksplitview.cpp @@ -1341,10 +1341,6 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event) qCDebug(qlcQQuickSplitViewMouse) << "handle item at index" << d->m_hoveredHandleIndex << "is no longer hovered"; d->m_hoveredHandleIndex = -1; - -#if QT_CONFIG(cursor) - setCursor(Qt::ArrowCursor); -#endif } else { // A child item of ours is hovered. @@ -1357,23 +1353,23 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event) } // Now check if the newly hovered item is actually a handle. - const int hoveredHandleIndex = d->m_handleItems.indexOf(hoveredItem); - if (hoveredHandleIndex == -1) - return; + d->m_hoveredHandleIndex = d->m_handleItems.indexOf(hoveredItem); - // It's a handle, so it's now hovered. - d->m_hoveredHandleIndex = hoveredHandleIndex; + if (d->m_hoveredHandleIndex != -1) { + QQuickSplitHandleAttached *handleAttached = qobject_cast<QQuickSplitHandleAttached*>( + qmlAttachedPropertiesObject<QQuickSplitHandleAttached>(hoveredItem, true)); + QQuickSplitHandleAttachedPrivate::get(handleAttached)->setHovered(true); - QQuickSplitHandleAttached *handleAttached = qobject_cast<QQuickSplitHandleAttached*>( - qmlAttachedPropertiesObject<QQuickSplitHandleAttached>(hoveredItem, true)); - QQuickSplitHandleAttachedPrivate::get(handleAttached)->setHovered(true); + qCDebug(qlcQQuickSplitViewMouse) << "handle item at index" << d->m_hoveredHandleIndex << "is now hovered"; + } + } #if QT_CONFIG(cursor) + if (d->m_hoveredHandleIndex != -1) setCursor(d->m_orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); + else + setCursor(Qt::ArrowCursor); #endif - - qCDebug(qlcQQuickSplitViewMouse) << "handle item at index" << d->m_hoveredHandleIndex << "is now hovered"; - } } void QQuickSplitView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |