From fdb75046726d3134ea4af3616385eae10f92df5d Mon Sep 17 00:00:00 2001 From: liuxinhao Date: Fri, 7 Apr 2023 09:26:09 +0800 Subject: [PATCH 2/4] 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