mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
Merge pull request #990 from ra3xdh/fix-drawresizehandle-usage
Fix unnecessary setPen before draw_resize_handle
This commit is contained in:
commit
aae2501748
@ -116,7 +116,7 @@ void TabDiagram::paintDiagram(QPainter *painter) {
|
|||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
painter->setPen(QPen(Qt::darkGray,3));
|
painter->setPen(QPen(Qt::darkGray,3));
|
||||||
painter->drawRect(-5, -y2-5, x2+10, y2+10);
|
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, -y2});
|
||||||
misc::draw_resize_handle(painter, QPoint{0, 0});
|
misc::draw_resize_handle(painter, QPoint{0, 0});
|
||||||
misc::draw_resize_handle(painter, QPoint{x2, -y2});
|
misc::draw_resize_handle(painter, QPoint{x2, -y2});
|
||||||
|
@ -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
|
// 1. Find out where on canvas lies the central point and remember these
|
||||||
// coordinates
|
// coordinates
|
||||||
// 2. Remove all transformations and draw the handle in its natural size
|
// 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));
|
resize_handle.moveCenter(painter->transform().map(center));
|
||||||
|
|
||||||
|
static QTransform transform{}; // reset transformation
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setTransform(QTransform{});
|
painter->setTransform(transform);
|
||||||
painter->setPen(QPen{Qt::darkRed, 2});
|
painter->setPen(QPen{Qt::darkRed, 2});
|
||||||
painter->drawRect(resize_handle);
|
painter->drawRect(resize_handle);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@ -57,8 +57,6 @@ void qucs::Ellipse::paint(QPainter *painter) {
|
|||||||
painter->setPen(QPen(Qt::white, Pen.width(), Pen.style()));
|
painter->setPen(QPen(Qt::white, Pen.width(), Pen.style()));
|
||||||
painter->drawEllipse(cx, cy, x2, y2);
|
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});
|
||||||
misc::draw_resize_handle(painter, QPoint{cx, cy + y2});
|
misc::draw_resize_handle(painter, QPoint{cx, cy + y2});
|
||||||
misc::draw_resize_handle(painter, QPoint{cx + x2, cy});
|
misc::draw_resize_handle(painter, QPoint{cx + x2, cy});
|
||||||
|
@ -52,8 +52,6 @@ void EllipseArc::paint(QPainter *painter) {
|
|||||||
painter->setPen(QPen(Qt::white, Pen.width(), Pen.style()));
|
painter->setPen(QPen(Qt::white, Pen.width(), Pen.style()));
|
||||||
painter->drawArc(cx, cy, x2, y2, Angle, ArcLen);
|
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});
|
||||||
misc::draw_resize_handle(painter, QPoint{cx, cy + y2});
|
misc::draw_resize_handle(painter, QPoint{cx, cy + y2});
|
||||||
misc::draw_resize_handle(painter, QPoint{cx + x2, cy});
|
misc::draw_resize_handle(painter, QPoint{cx + x2, cy});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user