Skip to content

Commit ff9a90a

Browse files
deepin-ci-robotkegechen
authored andcommitted
sync: from linuxdeepin/qt5integration
Synchronize source files from linuxdeepin/qt5integration. Source-pull-request: linuxdeepin/qt5integration#206
1 parent 9edc56a commit ff9a90a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

styleplugins/chameleon/chameleonstyle.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,9 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti
208208

209209
//QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理
210210
if (qobject_cast<const QTreeView *>(w)) {
211+
const auto &delegate = *qobject_cast<const QTreeView *>(w)->itemDelegate();
211212
//如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角)
212-
if (!qobject_cast<QStyledItemDelegate *>(qobject_cast<const QTreeView *>(w)->itemDelegate())) {
213+
if (typeid(delegate) != typeid(QStyledItemDelegate)) {
213214
break;
214215
}
215216

@@ -269,15 +270,15 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti
269270
p->setPen(Qt::NoPen);
270271
p->setBrush(getColor(opt, QPalette::Highlight));
271272
p->setRenderHint(QPainter::Antialiasing);
272-
p->drawRoundedRect(select_rect.adjusted(1, 1, -1, -1), frame_radius, frame_radius);
273+
p->drawRoundedRect(select_rect, frame_radius, frame_radius);
273274
return;
274275
} else {
275276
if (vopt->backgroundBrush.style() != Qt::NoBrush) {
276277
p->save();
277278
p->setPen(Qt::NoPen);
278279
p->setBrush(vopt->backgroundBrush);
279280
p->setRenderHint(QPainter::Antialiasing);
280-
p->drawRoundedRect(opt->rect.adjusted(1, 1, -1, -1), frame_radius, frame_radius);
281+
p->drawRoundedRect(opt->rect, frame_radius, frame_radius);
281282
p->restore();
282283
return;
283284
}
@@ -575,8 +576,9 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti
575576
}
576577
//这里QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理
577578
if (qobject_cast<const QTreeView *>(w)) {
579+
const auto &delegate = *qobject_cast<const QTreeView *>(w)->itemDelegate();
578580
//如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角)
579-
if (!qobject_cast<QStyledItemDelegate *>(qobject_cast<const QTreeView *>(w)->itemDelegate())) {
581+
if (typeid(delegate) != typeid(QStyledItemDelegate)) {
580582
break;
581583
}
582584

0 commit comments

Comments
 (0)