!19 [sync] PR-18: 调整主题绘制箭头,适配Qt5.11.1,通过宏区分调用Qt5.11.1的接口

From: @openeuler-sync-bot 
Reviewed-by: @tangjie02 
Signed-off-by: @tangjie02
This commit is contained in:
openeuler-ci-bot 2023-04-07 11:23:27 +00:00 committed by Gitee
commit 86e1d00a8b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 105 additions and 1 deletions

View File

@ -0,0 +1,67 @@
From fdb75046726d3134ea4af3616385eae10f92df5d Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
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

View File

@ -0,0 +1,32 @@
From b4a50383201b332bc13c90033f1d9821b2e0e0f7 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
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<QWidget *>::of(&QSignalMapper::mapped), this, &FontSizeManagerPrivate::handleBindWidgetDestroyed);
+#endif
}
void updateWidgetFont()
--
2.33.0

View File

@ -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 <liuxinhao@kylinsec.com.cn> - 2.4.0-3
- KYOS-F: Adaptation Qt5.11.1,Adjust the theme drawing arrow
* Fri Nov 25 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.4.0-2
- KYOS-F:Fix the memory leak of change theme