mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Fix bug 175
When use a "dark" Qt theme, some part of element are drawn white/gray instead of black.
This commit is contained in:
@@ -213,6 +213,16 @@ void Element::paint(
|
|||||||
drawHighlight(painter, options);
|
drawHighlight(painter, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Set default pen and brush to QPainter
|
||||||
|
//for avoid a strange bug when the Qt theme is a "dark" theme.
|
||||||
|
//Some part of an element are gray or white instead of black.
|
||||||
|
//This bug seems append only when the QPainter use drawPicture method.
|
||||||
|
//See bug 175. https://qelectrotech.org/bugtracker/view.php?id=175
|
||||||
|
painter->save();
|
||||||
|
QPen pen;
|
||||||
|
QBrush brush;
|
||||||
|
painter->setPen(pen);
|
||||||
|
painter->setBrush(brush);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||||
if (options && options -> levelOfDetail < 1.0)
|
if (options && options -> levelOfDetail < 1.0)
|
||||||
#else
|
#else
|
||||||
@@ -227,6 +237,8 @@ void Element::paint(
|
|||||||
painter->drawPicture(0, 0, m_picture);
|
painter->drawPicture(0, 0, m_picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
painter->restore(); //Restor the QPainter after use drawPicture
|
||||||
|
|
||||||
//Draw the selection rectangle
|
//Draw the selection rectangle
|
||||||
if ( isSelected() || m_mouse_over ) {
|
if ( isSelected() || m_mouse_over ) {
|
||||||
drawSelection(painter, options);
|
drawSelection(painter, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user