From 0622cb603869484c93acf6369965ec2eabd9ef6f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 11 Nov 2019 15:38:21 +0100 Subject: Amend d1fec8f050fc8f60b2cc2bf0e22a1e478f0e9048 to account for the theme Fixes: QTBUG-79929 Change-Id: I153684fa9c4e40d220986391671b0945b66393e1 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktheme.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/quicktemplates2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp index af49ffc9..1228714b 100644 --- a/src/quicktemplates2/qquicktheme.cpp +++ b/src/quicktemplates2/qquicktheme.cpp @@ -167,6 +167,8 @@ void QQuickTheme::setFont(Scope scope, const QFont &font) { Q_D(QQuickTheme); d->fonts[scope] = QSharedPointer::create(d->defaultFont ? d->defaultFont->resolve(font) : font); + // See comment in QQuickControlPrivate::inheritFont + d->fonts[scope]->setFamilies(QStringList()); } void QQuickTheme::setPalette(Scope scope, const QPalette &palette) -- cgit v1.2.3 From 19976fd5db1f2fb4925831c5f7a708c090e4a70e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 11 Nov 2019 13:44:22 +0100 Subject: SwipeView: fix issue where child items couldn't get focus Set the focus property of the contentItem (ListView) to the focus property of the SwipeView itself. Change-Id: Ic410f7fb8db9fbb758b956dfe07e1b4265f5f687 Fixes: QTBUG-62401 Reviewed-by: Richard Moe Gustavsen --- src/imports/controls/SwipeView.qml | 1 + src/imports/controls/imagine/SwipeView.qml | 1 + src/imports/controls/material/SwipeView.qml | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml index ad242e1a..7722d258 100644 --- a/src/imports/controls/SwipeView.qml +++ b/src/imports/controls/SwipeView.qml @@ -50,6 +50,7 @@ T.SwipeView { model: control.contentModel interactive: control.interactive currentIndex: control.currentIndex + focus: control.focus spacing: control.spacing orientation: control.orientation diff --git a/src/imports/controls/imagine/SwipeView.qml b/src/imports/controls/imagine/SwipeView.qml index 4998edb7..70d65fef 100644 --- a/src/imports/controls/imagine/SwipeView.qml +++ b/src/imports/controls/imagine/SwipeView.qml @@ -61,6 +61,7 @@ T.SwipeView { model: control.contentModel interactive: control.interactive currentIndex: control.currentIndex + focus: control.focus spacing: control.spacing orientation: control.orientation diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml index 12ea36ae..a84f16c5 100644 --- a/src/imports/controls/material/SwipeView.qml +++ b/src/imports/controls/material/SwipeView.qml @@ -50,6 +50,7 @@ T.SwipeView { model: control.contentModel interactive: control.interactive currentIndex: control.currentIndex + focus: control.focus spacing: control.spacing orientation: control.orientation -- cgit v1.2.3 From d04c7121acf66af75f557147ce8d055c62262608 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 7 Nov 2019 12:15:54 +0100 Subject: SplitView: refactor hover handling code - Don't unset the hovered flag only to potentially set it again. - Generally simplify the code. - Move it into a new updateHoveredHandle() function so that follow up patches can call it from other places. - Add more logging to debug hover issues. Change-Id: Iaf06cfe1f556a3f30bd0e883ef504b3df2dbc8e2 Reviewed-by: Richard Moe Gustavsen --- src/quicktemplates2/qquicksplitview.cpp | 77 ++++++++++++++----------------- src/quicktemplates2/qquicksplitview_p_p.h | 1 + 2 files changed, 36 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquicksplitview.cpp b/src/quicktemplates2/qquicksplitview.cpp index 56392e9a..ba7644a1 100644 --- a/src/quicktemplates2/qquicksplitview.cpp +++ b/src/quicktemplates2/qquicksplitview.cpp @@ -909,6 +909,40 @@ void QQuickSplitViewPrivate::updateHandleVisibilities() } } +void QQuickSplitViewPrivate::updateHoveredHandle(QQuickItem *hoveredItem) +{ + Q_Q(QQuickSplitView); + const int oldHoveredHandleIndex = m_hoveredHandleIndex; + m_hoveredHandleIndex = m_handleItems.indexOf(hoveredItem); + if (m_hoveredHandleIndex == oldHoveredHandleIndex) + return; + + // First, clear the hovered flag of any previously-hovered handle. + if (oldHoveredHandleIndex != -1) { + QQuickItem *oldHoveredHandle = m_handleItems.at(oldHoveredHandleIndex); + QQuickSplitHandleAttached *oldHoveredHandleAttached = qobject_cast( + qmlAttachedPropertiesObject(oldHoveredHandle, true)); + QQuickSplitHandleAttachedPrivate::get(oldHoveredHandleAttached)->setHovered(false); + qCDebug(qlcQQuickSplitViewMouse) << "handle item at index" << oldHoveredHandleIndex << "is no longer hovered"; + } + + if (m_hoveredHandleIndex != -1) { + QQuickSplitHandleAttached *handleAttached = qobject_cast( + qmlAttachedPropertiesObject(hoveredItem, true)); + QQuickSplitHandleAttachedPrivate::get(handleAttached)->setHovered(true); + qCDebug(qlcQQuickSplitViewMouse) << "handle item at index" << m_hoveredHandleIndex << "is now hovered"; + } else { + qCDebug(qlcQQuickSplitViewMouse) << "either there is no hovered item or" << hoveredItem << "is not a handle"; + } + +#if QT_CONFIG(cursor) + if (m_hoveredHandleIndex != -1) + q->setCursor(m_orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); + else + q->setCursor(Qt::ArrowCursor); +#endif +} + void QQuickSplitViewPrivate::setResizing(bool resizing) { Q_Q(QQuickSplitView); @@ -1327,48 +1361,7 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event) QQuickContainer::hoverMoveEvent(event); QQuickItem *hoveredItem = childAt(event->pos().x(), event->pos().y()); - if (!hoveredItem) { - // No handle is hovered. - if (d->m_hoveredHandleIndex != -1) { - // The previously-hovered handle is no longer hovered. - QQuickItem *oldHoveredHandle = d->m_handleItems.at(d->m_hoveredHandleIndex); - QQuickSplitHandleAttached *handleAttached = qobject_cast( - qmlAttachedPropertiesObject(oldHoveredHandle, true)); - QQuickSplitHandleAttachedPrivate::get(handleAttached)->setHovered(false); - } - - qCDebug(qlcQQuickSplitViewMouse) << "handle item at index" << d->m_hoveredHandleIndex << "is no longer hovered"; - - d->m_hoveredHandleIndex = -1; - } else { - // A child item of ours is hovered. - - // First, clear the hovered flag of any previously-hovered handle. - if (d->m_hoveredHandleIndex != -1) { - QQuickItem *oldHoveredHandle = d->m_handleItems.at(d->m_hoveredHandleIndex); - QQuickSplitHandleAttached *handleAttached = qobject_cast( - qmlAttachedPropertiesObject(oldHoveredHandle, true)); - QQuickSplitHandleAttachedPrivate::get(handleAttached)->setHovered(false); - } - - // Now check if the newly hovered item is actually a handle. - d->m_hoveredHandleIndex = d->m_handleItems.indexOf(hoveredItem); - - if (d->m_hoveredHandleIndex != -1) { - QQuickSplitHandleAttached *handleAttached = qobject_cast( - qmlAttachedPropertiesObject(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 + d->updateHoveredHandle(hoveredItem); } void QQuickSplitView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) diff --git a/src/quicktemplates2/qquicksplitview_p_p.h b/src/quicktemplates2/qquicksplitview_p_p.h index 5d71d461..ccefe5ec 100644 --- a/src/quicktemplates2/qquicksplitview_p_p.h +++ b/src/quicktemplates2/qquicksplitview_p_p.h @@ -74,6 +74,7 @@ public: void resizeHandle(QQuickItem *handleItem); void resizeHandles(); void updateHandleVisibilities(); + void updateHoveredHandle(QQuickItem *hoveredItem); void setResizing(bool resizing); bool isHorizontal() const; -- cgit v1.2.3 From 2193e9938e98af39a16f5035789c555f2574020b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 11 Nov 2019 12:49:44 +0100 Subject: Make ToolTips wrap Otherwise the text will go outside the window. Change-Id: I3d50a195b1ee6c9b5d49952ef6c49d17c61372fa Fixes: QTBUG-62350 Reviewed-by: Richard Moe Gustavsen --- src/imports/controls/ToolTip.qml | 2 +- src/imports/controls/fusion/ToolTip.qml | 2 +- src/imports/controls/imagine/ToolTip.qml | 2 +- src/imports/controls/material/ToolTip.qml | 2 +- src/imports/controls/universal/ToolTip.qml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml index ae903e4c..e0389903 100644 --- a/src/imports/controls/ToolTip.qml +++ b/src/imports/controls/ToolTip.qml @@ -58,8 +58,8 @@ T.ToolTip { contentItem: Text { text: control.text font: control.font + wrapMode: Text.Wrap color: control.palette.toolTipText - // TODO: wrapMode: Label.Wrap } background: Rectangle { diff --git a/src/imports/controls/fusion/ToolTip.qml b/src/imports/controls/fusion/ToolTip.qml index 73f561e4..b505e2c9 100644 --- a/src/imports/controls/fusion/ToolTip.qml +++ b/src/imports/controls/fusion/ToolTip.qml @@ -60,8 +60,8 @@ T.ToolTip { contentItem: Text { text: control.text font: control.font + wrapMode: Text.Wrap color: control.palette.toolTipText - // TODO: wrapMode: Label.Wrap } background: Rectangle { diff --git a/src/imports/controls/imagine/ToolTip.qml b/src/imports/controls/imagine/ToolTip.qml index 250452d8..21d75ebc 100644 --- a/src/imports/controls/imagine/ToolTip.qml +++ b/src/imports/controls/imagine/ToolTip.qml @@ -70,7 +70,7 @@ T.ToolTip { contentItem: Text { text: control.text font: control.font - // TODO: wrapMode: Label.Wrap + wrapMode: Text.Wrap color: control.palette.toolTipText } diff --git a/src/imports/controls/material/ToolTip.qml b/src/imports/controls/material/ToolTip.qml index fb705367..83afe4b1 100644 --- a/src/imports/controls/material/ToolTip.qml +++ b/src/imports/controls/material/ToolTip.qml @@ -70,7 +70,7 @@ T.ToolTip { contentItem: Text { text: control.text font: control.font - // TODO: wrapMode: Label.Wrap + wrapMode: Text.Wrap color: control.Material.foreground } diff --git a/src/imports/controls/universal/ToolTip.qml b/src/imports/controls/universal/ToolTip.qml index cf7325b6..431cdf7c 100644 --- a/src/imports/controls/universal/ToolTip.qml +++ b/src/imports/controls/universal/ToolTip.qml @@ -59,7 +59,7 @@ T.ToolTip { contentItem: Text { text: control.text font: control.font - // TODO: wrapMode: Label.Wrap + wrapMode: Text.Wrap opacity: enabled ? 1.0 : 0.2 color: control.Universal.foreground } -- cgit v1.2.3 From 73cd5c4aa762f15da3e0e1d4a4aabb1d5ddad762 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 11 Feb 2019 18:46:05 +0300 Subject: QQuickTheme: get rid of stale code q_ptr isn't used any more Change-Id: Ib73b8310c13b9b0cca9b0b277b66bef444ceeda2 Reviewed-by: Frederik Gladhorn --- src/quicktemplates2/qquicktheme.cpp | 1 - src/quicktemplates2/qquicktheme_p_p.h | 3 --- 2 files changed, 4 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp index 1228714b..f8c4a251 100644 --- a/src/quicktemplates2/qquicktheme.cpp +++ b/src/quicktemplates2/qquicktheme.cpp @@ -109,7 +109,6 @@ static QPlatformTheme::Palette platformPalette(QQuickTheme::Scope scope) QQuickTheme::QQuickTheme() : d_ptr(new QQuickThemePrivate) { - d_ptr->q_ptr = this; } QQuickTheme::~QQuickTheme() diff --git a/src/quicktemplates2/qquicktheme_p_p.h b/src/quicktemplates2/qquicktheme_p_p.h index c7421677..29058bc8 100644 --- a/src/quicktemplates2/qquicktheme_p_p.h +++ b/src/quicktemplates2/qquicktheme_p_p.h @@ -54,8 +54,6 @@ QT_BEGIN_NAMESPACE class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickThemePrivate { - Q_DECLARE_PUBLIC(QQuickTheme) - public: static QQuickThemePrivate *get(QQuickTheme *theme) { @@ -70,7 +68,6 @@ public: QScopedPointer defaultPalette; QSharedPointer fonts[NScopes]; QSharedPointer palettes[NScopes]; - QQuickTheme *q_ptr = nullptr; }; QT_END_NAMESPACE -- cgit v1.2.3