Skip to content

Restore properly rounded corners of popup messages

snooxx 💤 requested to merge snooxx/okular:snx/fix-roundedRect into release/22.04

Restore properly rounded corners of popup messages

78d983ee led to some rounded corners in the UI not being perfectly circular anymore: Popup messages would stretch the rounding depending on message length, and the rounded corner of the message in the annotation bar would get distorted while changing the sidebar's width.

That commit tried to fix the following warning: ‘void QPainter::drawRoundRect(int, int, int, int, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) by changing to drawRoundedRect, but missed to also add Qt::RelativeSize.

Adding the missing flag fixes both issues. The change is also implemented in dviRenderer::epsf_special (introduced in be544056, changed in 55dc43bf) for correctness.

Test Plan:

  • Start Okular. The "Welcome" message and the "Document Loaded" message have perfectly rounded corners again, not depending on message length.
  • Change width of the annotations sidebar: The "No Annotations" message does not change its rounded corners anymore.
  • Running in HiDPI mode retains the correct behavior.
  • Note: There does not seem to be a trivial/convenient way to trigger the DVI code path.

Bring corner radius of popup messages in line with widget style

In 0070baaf PageViewMessage to display on-canvas notifications was introduced, featuring rounded corners. Over the years, overall preferences in the industry regarding the corner radius have changed multiple times, with recent efforts trying to ensure a more consistent usage in the entire UI of KDE's products.

Let's use a corner radius better matching the radius commonly used in the current widget style, i.e. a bit less rounded, to make the message fit in better with surrounding buttons and frames. Note that this is not specific to Breeze, since most widget styles nowadays use a similar corner radius. The radius is compatible with KTextEditor::Message too, which is used in a similar context.

Test Plan:

  • Start Okular: The "Welcome" message and the "Document Loaded" message have a more professional look to them.
  • Open the annotations sidebar: The "No Annotations" message better fits in with the sidebar's frame.

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.

Regression: Original: Proposal:
1-issue 2-old 3-new
Edited by snooxx 💤

Merge request reports

Loading