diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2023-01-29 01:08:17 +0100 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2023-01-29 01:12:14 +0100 |
commit | dd0a11a066ff688e97175771791b0f8924f2eadf (patch) | |
tree | 3f1720295164cd009057d0914fea1bc418f68355 /kde-frameworks | |
parent | kde-frameworks/plasma: Adjust fade animation to not flicker as much (diff) | |
download | gentoo-dd0a11a066ff688e97175771791b0f8924f2eadf.tar.gz gentoo-dd0a11a066ff688e97175771791b0f8924f2eadf.tar.bz2 gentoo-dd0a11a066ff688e97175771791b0f8924f2eadf.zip |
kde-frameworks/kirigami: Page: Fix title delegate elision glitch
Upstream commits:
f69ff1b0fec56486fd96fd1154160593c1ccedeb
eacfc6961158cc4f493a5d7e3c47619157f54291
See also:
https://invent.kde.org/frameworks/kirigami/-/merge_requests/900
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks')
3 files changed, 228 insertions, 0 deletions
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 <me@ratijas.tk> +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 <me@ratijas.tk> +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 <me@ratijas.tk> ++ * ++ * 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 + diff --git a/kde-frameworks/kirigami/kirigami-5.102.0-r1.ebuild b/kde-frameworks/kirigami/kirigami-5.102.0-r1.ebuild new file mode 100644 index 000000000000..246e902cfecb --- /dev/null +++ b/kde-frameworks/kirigami/kirigami-5.102.0-r1.ebuild @@ -0,0 +1,55 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_EXAMPLES="true" +ECM_QTHELP="false" +ECM_TEST="true" +KDE_ORG_NAME="${PN}2" +QTMIN=5.15.5 +inherit ecm frameworks.kde.org toolchain-funcs + +DESCRIPTION="Lightweight user interface framework for mobile and convergent applications" +HOMEPAGE="https://techbase.kde.org/Kirigami" +EGIT_REPO_URI="${EGIT_REPO_URI/${PN}2/${PN}}" + +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" +IUSE="+openmp" + +# requires package to already be installed +RESTRICT="test" + +DEPEND=" + >=dev-qt/qtconcurrent-${QTMIN}:5 + >=dev-qt/qtdbus-${QTMIN}:5 + >=dev-qt/qtdeclarative-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtnetwork-${QTMIN}:5 + >=dev-qt/qtquickcontrols2-${QTMIN}:5 + >=dev-qt/qtsvg-${QTMIN}:5 +" +RDEPEND="${DEPEND} + >=dev-qt/qtgraphicaleffects-${QTMIN}:5 +" +BDEPEND=">=dev-qt/linguist-tools-${QTMIN}:5" + +PATCHES=( "${FILESDIR}"/${P}-fix-title-delegate-elision-glitch-{1,2}.patch ) + +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +src_configure() { + local mycmakeargs=( + -DBUILD_EXAMPLES=$(usex examples) + $(cmake_use_find_package openmp OpenMP) + ) + + ecm_src_configure +} |