Skip to content

Commit

Permalink
sync: from linuxdeepin/qt5integration
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/qt5integration.

Source-pull-request: linuxdeepin/qt5integration#206
  • Loading branch information
deepin-ci-robot authored and kegechen committed Jan 2, 2024
1 parent 9edc56a commit ff9a90a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions styleplugins/chameleon/chameleonstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti

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

Expand Down Expand Up @@ -269,15 +270,15 @@ 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) {
p->save();
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;
}
Expand Down Expand Up @@ -575,8 +576,9 @@ void ChameleonStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOpti
}
//这里QTreeView的绘制复制了QCommonStyle的代码,添加了圆角的处理,hover的处理
if (qobject_cast<const QTreeView *>(w)) {
const auto &delegate = *qobject_cast<const QTreeView *>(w)->itemDelegate();
//如果QTreeView使用的不是默认代理 QStyledItemDelegate,则采取DStyle的默认绘制(备注:这里的QtCreator不会有hover效果和圆角)
if (!qobject_cast<QStyledItemDelegate *>(qobject_cast<const QTreeView *>(w)->itemDelegate())) {
if (typeid(delegate) != typeid(QStyledItemDelegate)) {
break;
}

Expand Down

0 comments on commit ff9a90a

Please sign in to comment.