Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unnecessary setPen before draw_resize_handle #990

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qucs/diagrams/tabdiagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void TabDiagram::paintDiagram(QPainter *painter) {
if (isSelected) {
painter->setPen(QPen(Qt::darkGray,3));
painter->drawRect(-5, -y2-5, x2+10, y2+10);
painter->setPen(QPen(Qt::darkRed,2));

misc::draw_resize_handle(painter, QPoint{0, -y2});
misc::draw_resize_handle(painter, QPoint{0, 0});
misc::draw_resize_handle(painter, QPoint{x2, -y2});
Expand Down
5 changes: 3 additions & 2 deletions qucs/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,11 +846,12 @@ void misc::draw_resize_handle(QPainter* painter, const QPointF& center) {
// 1. Find out where on canvas lies the central point and remember these
// coordinates
// 2. Remove all transformations and draw the handle in its natural size
QRectF resize_handle{0, 0, 10, 10}; // nothing special, just a size
static QRectF resize_handle{0, 0, 10, 10}; // nothing special, just a size
resize_handle.moveCenter(painter->transform().map(center));

static QTransform transform{}; // reset transformation
painter->save();
painter->setTransform(QTransform{});
painter->setTransform(transform);
painter->setPen(QPen{Qt::darkRed, 2});
painter->drawRect(resize_handle);
painter->restore();
Expand Down
2 changes: 0 additions & 2 deletions qucs/paintings/ellipse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ void qucs::Ellipse::paint(QPainter *painter) {
painter->setPen(QPen(Qt::white, Pen.width(), Pen.style()));
painter->drawEllipse(cx, cy, x2, y2);

painter->setPen(QPen(Qt::darkRed,2));

misc::draw_resize_handle(painter, QPoint{cx, cy});
misc::draw_resize_handle(painter, QPoint{cx, cy + y2});
misc::draw_resize_handle(painter, QPoint{cx + x2, cy});
Expand Down
2 changes: 0 additions & 2 deletions qucs/paintings/ellipsearc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ void EllipseArc::paint(QPainter *painter) {
painter->setPen(QPen(Qt::white, Pen.width(), Pen.style()));
painter->drawArc(cx, cy, x2, y2, Angle, ArcLen);

painter->setPen(QPen(Qt::darkRed, 2));

misc::draw_resize_handle(painter, QPoint{cx, cy});
misc::draw_resize_handle(painter, QPoint{cx, cy + y2});
misc::draw_resize_handle(painter, QPoint{cx + x2, cy});
Expand Down
Loading