public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kirigami/files/, kde-frameworks/kirigami/
Date: Sun, 29 Jan 2023 00:12:21 +0000 (UTC)	[thread overview]
Message-ID: <1674951134.dd0a11a066ff688e97175771791b0f8924f2eadf.asturm@gentoo> (raw)

commit:     dd0a11a066ff688e97175771791b0f8924f2eadf
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 29 00:08:17 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Jan 29 00:12:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd0a11a0

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 <AT> gentoo.org>

 ...102.0-fix-title-delegate-elision-glitch-1.patch |  59 +++++++++++
 ...102.0-fix-title-delegate-elision-glitch-2.patch | 114 +++++++++++++++++++++
 kde-frameworks/kirigami/kirigami-5.102.0-r1.ebuild |  55 ++++++++++
 3 files changed, 228 insertions(+)

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
+}


             reply	other threads:[~2023-01-29  0:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-29  0:12 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-15 13:46 [gentoo-commits] repo/gentoo:master commit in: kde-frameworks/kirigami/files/, kde-frameworks/kirigami/ Andreas Sturmlechner
2024-09-05 13:19 Sam James
2024-01-04 13:33 Andreas Sturmlechner
2021-04-04 13:23 Andreas Sturmlechner
2021-01-23 13:29 Andreas Sturmlechner
2020-09-29 12:49 Andreas Sturmlechner
2020-02-12 21:30 Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1674951134.dd0a11a066ff688e97175771791b0f8924f2eadf.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox