From ff9a90ad712405d4e3eb88ac77a2afad619b3e8b Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Thu, 14 Dec 2023 07:31:17 +0000 Subject: [PATCH] sync: from linuxdeepin/qt5integration Synchronize source files from linuxdeepin/qt5integration. Source-pull-request: https://github.com/linuxdeepin/qt5integration/pull/206 --- styleplugins/chameleon/chameleonstyle.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index bf3f50b..6814613 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -208,8 +208,9 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti //QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理 if (qobject_cast(w)) { + const auto &delegate = *qobject_cast(w)->itemDelegate(); //如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角) - if (!qobject_cast(qobject_cast(w)->itemDelegate())) { + if (typeid(delegate) != typeid(QStyledItemDelegate)) { break; } @@ -269,7 +270,7 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti p->setPen(Qt::NoPen); p->setBrush(getColor(opt, QPalette::Highlight)); p->setRenderHint(QPainter::Antialiasing); - p->drawRoundedRect(select_rect.adjusted(1, 1, -1, -1), frame_radius, frame_radius); + p->drawRoundedRect(select_rect, frame_radius, frame_radius); return; } else { if (vopt->backgroundBrush.style() != Qt::NoBrush) { @@ -277,7 +278,7 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti p->setPen(Qt::NoPen); p->setBrush(vopt->backgroundBrush); p->setRenderHint(QPainter::Antialiasing); - p->drawRoundedRect(opt->rect.adjusted(1, 1, -1, -1), frame_radius, frame_radius); + p->drawRoundedRect(opt->rect, frame_radius, frame_radius); p->restore(); return; } @@ -575,8 +576,9 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti } //这里QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理 if (qobject_cast(w)) { + const auto &delegate = *qobject_cast(w)->itemDelegate(); //如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角) - if (!qobject_cast(qobject_cast(w)->itemDelegate())) { + if (typeid(delegate) != typeid(QStyledItemDelegate)) { break; }