Merge pull request #383 from plc-user/master

adjust zoom-factor to use cosmetic-line and fixed comments
This commit is contained in:
Laurent Trinques 2025-03-07 11:07:31 +01:00 committed by GitHub
commit 3c2c889922
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 8 deletions

View File

@ -519,8 +519,8 @@ void Conductor::paint(QPainter *painter, const QStyleOptionGraphicsItem *options
final_conductor_pen.setStyle(m_properties.style);
final_conductor_pen.setJoinStyle(Qt::SvgMiterJoin); // better rendering with dot
//Use a cosmetique line, below a certain zoom
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
//Use a cosmetic line, below a certain zoom
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
{
final_conductor_pen.setCosmetic(true);
}

View File

@ -215,24 +215,24 @@ void Element::paint(
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.
//Set default pen and brush to QPainter to avoid a strange bug when
//the Qt theme is a "dark" theme.
//Some parts of an element are gray or white instead of black.
//This bug seems append only when the QPainter uses 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 (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 1.0)
if (options && options->levelOfDetailFromTransform(painter->worldTransform()) < 0.5)
{
painter->drawPicture(0, 0, m_low_zoom_picture);
} else {
painter->drawPicture(0, 0, m_picture);
}
painter->restore(); //Restorr the QPainter after use drawPicture
painter->restore(); //Restore the QPainter after use drawPicture
//Draw the selection rectangle
if ( isSelected() || m_mouse_over ) {