Skip to content

Commit

Permalink
fix: Palette icons background (bad)
Browse files Browse the repository at this point in the history
Signed-off-by: AlexandrKudrya <[email protected]>
  • Loading branch information
AlexandrKudrya committed Nov 18, 2024
1 parent a0163b9 commit 70d985b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions qrgui/plugins/pluginManager/sdfRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void SdfRenderer::render(QPainter *painter, const QRectF &bounds, bool isIcon)
mStartX = static_cast<int>(bounds.x());
mStartY = static_cast<int>(bounds.y());
this->painter = painter;

QDomElement docElem = doc.documentElement();
QDomNode node = docElem.firstChild();
while(!node.isNull())
Expand Down Expand Up @@ -821,6 +822,7 @@ void SdfIconEngineV2::paint(QPainter *painter, const QRect &rect, QIcon::Mode mo
Q_UNUSED(mode)
Q_UNUSED(state)
painter->eraseRect(rect);

int rh = rect.height();
int rw = rect.width();

Expand All @@ -839,6 +841,11 @@ void SdfIconEngineV2::paint(QPainter *painter, const QRect &rect, QIcon::Mode mo
resRect.setTop(rect.top() + (rh - rw * ph / pw) / 2);
resRect.setBottom(rect.bottom() - (rh - rw * ph / pw) / 2);
}

QPixmap image(rh, rw);
image.fill(QApplication::palette().color(QPalette::Base));
painter->drawPixmap(0, 0, image);

painter->setRenderHint(QPainter::Antialiasing, true);
mRenderer.render(painter, resRect, true);
}
Expand Down

0 comments on commit 70d985b

Please sign in to comment.