From 2ad9e6f0b322d0e5f3603a5d686bd718b479da28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?snooxx=20=F0=9F=92=A4?= Date: Wed, 9 Mar 2022 22:38:55 +0000 Subject: [PATCH] Simplify `QPainter::drawRoundedRect` usage After fixing the porting mistake done in 78d983ee, `drawRoundedRect` can be further simplified to not use any relative sizes anymore. We can also assume that the code in `dviRenderer::epsf_special` was supposed to use a constant corner radius and therefore was wrong initially. By dropping `Qt::RelativeSize` the code might become closer to its originally intended behavior. Test Plan: - No change in behavior for rounded corners of "Welcome" popup message and "No Annotations" message in sidebar. - Could not test DVI code path. --- generators/dvi/special.cpp | 2 +- part/pageviewutils.cpp | 2 +- part/side_reviews.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generators/dvi/special.cpp b/generators/dvi/special.cpp index 3593e5603..204c6fd3c 100644 --- a/generators/dvi/special.cpp +++ b/generators/dvi/special.cpp @@ -433,7 +433,7 @@ void dviRenderer::epsf_special(const QString &cp) foreGroundPainter->setBrush(Qt::red); } foreGroundPainter->setPen(Qt::black); - foreGroundPainter->drawRoundedRect(bbox, 2, 2, Qt::RelativeSize); + foreGroundPainter->drawRoundedRect(bbox, 2, 2); QFont f = foreGroundPainter->font(); f.setPointSize(8); foreGroundPainter->setFont(f); diff --git a/part/pageviewutils.cpp b/part/pageviewutils.cpp index 13fa695ba..3da2fb52c 100644 --- a/part/pageviewutils.cpp +++ b/part/pageviewutils.cpp @@ -360,7 +360,7 @@ void PageViewMessage::paintEvent(QPaintEvent * /* e */) painter.setPen(Qt::black); painter.setBrush(palette().color(QPalette::Window)); painter.translate(0.5, 0.5); - painter.drawRoundedRect(1, 1, width() - 2, height() - 2, 600.0 / width(), 600.0 / height(), Qt::RelativeSize); + painter.drawRoundedRect(1, 1, width() - 2, height() - 2, 3, 3); // draw icon if present if (!m_symbol.isNull()) { diff --git a/part/side_reviews.cpp b/part/side_reviews.cpp index c85ea20b9..78aa8c2ec 100644 --- a/part/side_reviews.cpp +++ b/part/side_reviews.cpp @@ -72,7 +72,7 @@ protected: p.setBrush(palette().window()); p.translate(0.5, 0.5); - p.drawRoundedRect(15, 15, w, h, (3 * 200.0) / w, (3 * 200.0) / h, Qt::RelativeSize); + p.drawRoundedRect(15, 15, w, h, 3, 3); p.translate(20, 20); document.drawContents(&p);