qtreeview qmenu图标未反白处理

This commit is contained in:
tanjing 2024-01-03 17:01:12 +08:00
parent 1e498aa641
commit 0e458afded
1 changed files with 15 additions and 3 deletions

View File

@ -2310,7 +2310,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
pixmap = proxy()->generatedIconPixmap(mode, pixmap, option);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
if(!sp->indicatorIconHoverNeedHighLight)
if(!sp->indicatorIconHoverNeedHighLight && !widget->inherits("QMenu"))
target = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
@ -2354,7 +2354,7 @@ void UKUIConfigStyle::drawPrimitive(QStyle::PrimitiveElement element, const QSty
QPixmap pixmap = icon.pixmap(iconsize, mode, QIcon::Off);
pixmap = proxy()->generatedIconPixmap(mode, pixmap, option);
QPixmap target = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
if(!sp->indicatorIconHoverNeedHighLight)
if(!sp->indicatorIconHoverNeedHighLight && !widget->inherits("QMenu"))
target = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget);
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
@ -6194,7 +6194,19 @@ void UKUIConfigStyle::drawControl(QStyle::ControlElement element, const QStyleOp
// mode = QIcon::Selected;
QIcon::State state = vi->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
QPixmap pixmap = vi->icon.pixmap(vi->decorationSize, mode, state);
pixmap = proxy()->generatedIconPixmap(mode, pixmap, vi);
if(!sp->indicatorIconHoverNeedHighLight)
pixmap = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget);
else if(widget && (widget->inherits("QTreeView") || widget->inherits("QTreeWidget"))){
if(widget->property("highlightMode").isValid() && widget->property("highlightMode").toBool())
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
else
pixmap = HighLightEffect::ordinaryGeneratePixmap(pixmap, option, widget);
}
else
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, option, widget);
//pixmap = proxy()->generatedIconPixmap(mode, pixmap, vi);
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
proxy()->drawItemPixmap(painter, iconRect, vi->decorationAlignment, HighLightEffect::ordinaryGeneratePixmap(pixmap, vi, widget));
}