From b8ec9071f5d20d8518b02d0077428b2c9f88861b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 29 Jan 2023 02:53:24 +0000 Subject: gentoo auto-resync : 29:01:2023 - 02:53:24 --- ...102.0-fix-title-delegate-elision-glitch-1.patch | 59 +++++++++++ ...102.0-fix-title-delegate-elision-glitch-2.patch | 114 +++++++++++++++++++++ 2 files changed, 173 insertions(+) create mode 100644 kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-1.patch create mode 100644 kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-2.patch (limited to 'kde-frameworks/kirigami/files') diff --git a/kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-1.patch b/kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-1.patch new file mode 100644 index 000000000000..31d38f3313b2 --- /dev/null +++ b/kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-1.patch @@ -0,0 +1,59 @@ +From f69ff1b0fec56486fd96fd1154160593c1ccedeb Mon Sep 17 00:00:00 2001 +From: ivan tkachenko +Date: Wed, 11 Jan 2023 02:50:10 +0300 +Subject: [PATCH] Page: Fix title delegate elision glitch + +Implicitly sized items like QtQuick/Text don't play nicely with Loader, +and generally with kinda-recursive bindings on Layout.* properties. + +This combination of two fixes does the trick: + +1. Use extra TextMetrics for reliable width/height values. +2. Round up text's advance width, so that container loader or layout +won't ever round it down (which it did with implicitWidth before). + +(cherry picked from commit bc03a15b52c7512a1757da77963be5e1e48d5df1) +--- + src/controls/Page.qml | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/src/controls/Page.qml b/src/controls/Page.qml +index fccb96ebb..8c9aa04ab 100644 +--- a/src/controls/Page.qml ++++ b/src/controls/Page.qml +@@ -248,14 +248,26 @@ QQC2.Page { + */ + property Component titleDelegate: Component { + id: defaultTitleDelegate +- Kirigami.Heading { ++ Item { + Layout.fillWidth: true +- Layout.maximumWidth: implicitWidth + 1 // The +1 is to make sure we do not trigger eliding at max width + Layout.minimumWidth: 0 +- maximumLineCount: 1 +- elide: Text.ElideRight +- text: root.title +- textFormat: Text.PlainText ++ Layout.maximumWidth: implicitWidth ++ implicitWidth: Math.ceil(metrics.advanceWidth) ++ implicitHeight: metrics.height ++ ++ Kirigami.Heading { ++ id: heading ++ anchors.fill: parent ++ maximumLineCount: 1 ++ elide: Text.ElideRight ++ text: root.title ++ textFormat: Text.PlainText ++ } ++ TextMetrics { ++ id: metrics ++ font: heading.font ++ text: heading.text ++ } + } + } + +-- +GitLab + diff --git a/kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-2.patch b/kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-2.patch new file mode 100644 index 000000000000..4da10130a1b7 --- /dev/null +++ b/kde-frameworks/kirigami/files/kirigami-5.102.0-fix-title-delegate-elision-glitch-2.patch @@ -0,0 +1,114 @@ +From eacfc6961158cc4f493a5d7e3c47619157f54291 Mon Sep 17 00:00:00 2001 +From: ivan tkachenko +Date: Wed, 11 Jan 2023 23:00:03 +0300 +Subject: [PATCH] Page: Split default page title delegate into separate + component + +There's no need to clutter Page component with potentially unused Items +and IDs, and an extra self-contained component wouldn't hurt. + +(cherry picked from commit e9f19ecd20a881a6bfeaf0676fc8d6f570fe387f) +--- + src/CMakeLists.txt | 1 + + src/controls/Page.qml | 22 +--------- + .../private/DefaultPageTitleDelegate.qml | 43 +++++++++++++++++++ + 3 files changed, 46 insertions(+), 20 deletions(-) + create mode 100644 src/controls/private/DefaultPageTitleDelegate.qml + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 28c17c137..e3e7b3569 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -216,6 +216,7 @@ ecm_target_qml_sources(KirigamiPlugin PRIVATE PATH private SOURCES + controls/private/DefaultCardBackground.qml + controls/private/DefaultChipBackground.qml + controls/private/DefaultListItemBackground.qml ++ controls/private/DefaultPageTitleDelegate.qml + controls/private/EdgeShadow.qml + controls/private/GlobalDrawerActionItem.qml + controls/private/PageActionPropertyGroup.qml +diff --git a/src/controls/Page.qml b/src/controls/Page.qml +index 8c9aa04ab..2641b96cf 100644 +--- a/src/controls/Page.qml ++++ b/src/controls/Page.qml +@@ -248,26 +248,8 @@ QQC2.Page { + */ + property Component titleDelegate: Component { + id: defaultTitleDelegate +- Item { +- Layout.fillWidth: true +- Layout.minimumWidth: 0 +- Layout.maximumWidth: implicitWidth +- implicitWidth: Math.ceil(metrics.advanceWidth) +- implicitHeight: metrics.height +- +- Kirigami.Heading { +- id: heading +- anchors.fill: parent +- maximumLineCount: 1 +- elide: Text.ElideRight +- text: root.title +- textFormat: Text.PlainText +- } +- TextMetrics { +- id: metrics +- font: heading.font +- text: heading.text +- } ++ P.DefaultPageTitleDelegate { ++ text: root.title + } + } + +diff --git a/src/controls/private/DefaultPageTitleDelegate.qml b/src/controls/private/DefaultPageTitleDelegate.qml +new file mode 100644 +index 000000000..8c84d1b5c +--- /dev/null ++++ b/src/controls/private/DefaultPageTitleDelegate.qml +@@ -0,0 +1,43 @@ ++/* ++ * SPDX-FileCopyrightText: 2023 ivan tkachenko ++ * ++ * SPDX-License-Identifier: LGPL-2.0-or-later ++ */ ++ ++import QtQuick 2.15 ++import QtQuick.Layouts 1.15 ++import org.kde.kirigami 2.20 as Kirigami ++ ++/** ++ * This component is used as a default representation for a page title within ++ * page's header/toolbar. It is just a Heading item with shrinking + eliding ++ * behavior. ++ * ++ * \private ++ */ ++Item { ++ property alias text: heading.text ++ ++ Layout.fillWidth: true ++ Layout.minimumWidth: 0 ++ Layout.maximumWidth: implicitWidth ++ ++ implicitWidth: Math.ceil(metrics.advanceWidth) ++ implicitHeight: metrics.height ++ ++ Kirigami.Heading { ++ id: heading ++ ++ anchors.fill: parent ++ maximumLineCount: 1 ++ elide: Text.ElideRight ++ textFormat: Text.PlainText ++ } ++ ++ TextMetrics { ++ id: metrics ++ ++ font: heading.font ++ text: heading.text ++ } ++} +-- +GitLab + -- cgit v1.2.3