From 343de37831097055eb1d2d623dabd13bc9099a79 Mon Sep 17 00:00:00 2001 From: liuxinhao Date: Fri, 7 Apr 2023 10:40:23 +0800 Subject: [PATCH] fix(arrow & qt5.11.1): Adjust the theme drawing arrow,Adaptation Qt5.11.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整主题绘制箭头.适配Qt5.11.1,通过宏区分调用Qt5.11.1的接口 (cherry picked from commit 1a343777fb49a7f1bd89c51e8b28de741ac43b25) --- ...arrow-Adjust-the-theme-drawing-arrow.patch | 67 +++++++++++++++++++ 0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch | 32 +++++++++ kiran-qt5-integration.spec | 7 +- 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 0001-fix-arrow-Adjust-the-theme-drawing-arrow.patch create mode 100644 0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch diff --git a/0001-fix-arrow-Adjust-the-theme-drawing-arrow.patch b/0001-fix-arrow-Adjust-the-theme-drawing-arrow.patch new file mode 100644 index 0000000..846c4dd --- /dev/null +++ b/0001-fix-arrow-Adjust-the-theme-drawing-arrow.patch @@ -0,0 +1,67 @@ +From fdb75046726d3134ea4af3616385eae10f92df5d Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Fri, 7 Apr 2023 09:26:09 +0800 +Subject: [PATCH 1/2] fix(arrow): Adjust the theme drawing arrow +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 调整主题绘制箭头 +--- + style/src/metrics.h | 2 +- + style/src/render-helper.cpp | 2 +- + style/src/style.cpp | 5 ++++- + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/style/src/metrics.h b/style/src/metrics.h +index 4248347..05169e4 100644 +--- a/style/src/metrics.h ++++ b/style/src/metrics.h +@@ -130,7 +130,7 @@ struct Metrics + static constexpr int Header_ArrowSize = 10; + + // tree view +- static constexpr int ItemView_ArrowSize = 12; ++ static constexpr int ItemView_ArrowSize = 10; + static constexpr int ItemView_ItemMarginWidth = 3; + static constexpr int SidePanel_ItemMarginWidth = 4; + +diff --git a/style/src/render-helper.cpp b/style/src/render-helper.cpp +index 60f66e3..9bf66d2 100644 +--- a/style/src/render-helper.cpp ++++ b/style/src/render-helper.cpp +@@ -318,7 +318,7 @@ QPixmap RenderHelper::changeSVGFillColor(const QString &svgFile, const QColor &f + + void RenderHelper::renderArrow(QPainter *painter, const QRect &rect, ArrowOrientation orientation, const QColor &color, const QSize &arrowSize) + { +- QString svgFile = QString(":/style-helper/images/arrow.svg"); ++ QString svgFile = QString(":/style-helper/images/arrow-down.svg"); + PainterSaver painterSave(painter); + painter->setRenderHint(QPainter::Antialiasing); + +diff --git a/style/src/style.cpp b/style/src/style.cpp +index 235346d..abe5517 100644 +--- a/style/src/style.cpp ++++ b/style/src/style.cpp +@@ -664,6 +664,9 @@ QPixmap Style::standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyl + { + switch (standardPixmap) + { ++ case SP_ArrowUp: ++ case SP_ArrowDown: ++ case SP_ArrowLeft: + case SP_ArrowRight: + { + QPalette palette = widget ? widget->palette() : qApp->palette(); +@@ -671,7 +674,7 @@ QPixmap Style::standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyl + QPixmap arrowPixmap(16, 16); + arrowPixmap.fill(Qt::transparent); + QPainter painter(&arrowPixmap); +- RenderHelper::renderArrow(&painter, arrowPixmap.rect(), Arrow_Right, palette.color(colorRole)); ++ RenderHelper::renderArrow(&painter, arrowPixmap.rect(), (Kiran::ArrowOrientation)((int)standardPixmap-SP_ArrowUp), palette.color(colorRole)); + return arrowPixmap; + } + default: +-- +2.33.0 + diff --git a/0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch b/0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch new file mode 100644 index 0000000..da23be0 --- /dev/null +++ b/0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch @@ -0,0 +1,32 @@ +From b4a50383201b332bc13c90033f1d9821b2e0e0f7 Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Fri, 7 Apr 2023 09:27:04 +0800 +Subject: [PATCH 2/2] build(qt5.11.1): Adaptation Qt5.11.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 适配Qt5.11.1,通过宏区分调用Qt5.11.1的接口 +--- + style-helper/src/font-size-manager-private.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/style-helper/src/font-size-manager-private.h b/style-helper/src/font-size-manager-private.h +index a7a5577..eccf04b 100644 +--- a/style-helper/src/font-size-manager-private.h ++++ b/style-helper/src/font-size-manager-private.h +@@ -26,7 +26,11 @@ public: + void init() + { + connect(qGuiApp, &QGuiApplication::fontChanged, this, &FontSizeManagerPrivate::handleGuiAppFontChanged); ++#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + connect(&m_destorySignalMapper, &QSignalMapper::mappedWidget, this, &FontSizeManagerPrivate::handleBindWidgetDestroyed); ++#else ++ connect(&m_destorySignalMapper, QOverload::of(&QSignalMapper::mapped), this, &FontSizeManagerPrivate::handleBindWidgetDestroyed); ++#endif + } + + void updateWidgetFont() +-- +2.33.0 + diff --git a/kiran-qt5-integration.spec b/kiran-qt5-integration.spec index f7dc920..7984073 100644 --- a/kiran-qt5-integration.spec +++ b/kiran-qt5-integration.spec @@ -1,11 +1,13 @@ Name: kiran-qt5-integration Version: 2.4.0 -Release: 2 +Release: 3 Summary: Kiran desktop platform integration plugin. License: MulanPSL-2.0 Source0: %{name}-%{version}.tar.gz Patch0001: 0001-fix-Memory-leak-Fix-the-memory-leak.patch +Patch0002: 0001-fix-arrow-Adjust-the-theme-drawing-arrow.patch +Patch0003: 0002-build-qt5.11.1-Adaptation-Qt5.11.1.patch BuildRequires: cmake >= 3.2 BuildRequires: gcc-c++ @@ -61,6 +63,9 @@ make %{?_smp_mflags} %{_libdir}/pkgconfig/kiran-style-helper.pc %changelog +* Fri Apr 07 2023 liuxinhao - 2.4.0-3 +- KYOS-F: Adaptation Qt5.11.1,Adjust the theme drawing arrow + * Fri Nov 25 2022 liuxinhao - 2.4.0-2 - KYOS-F:Fix the memory leak of change theme -- Gitee