Skip to content

ui/clickandgowidget: fix scaling issues on high-DPI screens#1947

Open
jpue wants to merge 1 commit intomcallegari:masterfrom
jpue:scaling
Open

ui/clickandgowidget: fix scaling issues on high-DPI screens#1947
jpue wants to merge 1 commit intomcallegari:masterfrom
jpue:scaling

Conversation

@jpue
Copy link
Copy Markdown
Contributor

@jpue jpue commented Feb 5, 2026

Describe the bug / To Reproduce

  1. Start QLC+ (v4, compiled with Qt6 (!), new workspace) on a system with a scaled screen (Windows: set the display scaling in the Settings app > 100%, Ubuntu/Linux: QT_SCALE_FACTOR=1.5 qlcplus …)
  2. Add a fixture with preset channels (for example a moving head, I used the Tomshine Mini Gobo Moving Head) and switch to the Simple Desk.
  3. Click on the icon at the top of the “Colour wheel” or “Gobo wheel” channel slider.
  4. Both the text labels as well as the images/icons look badly scaled.

Expected behaviour
Regardless of the resolution or scaling, all text labels and icons should be drawn sharply, with the possible exception of raster images, which have a low resolution to begin with.

Problem Analysis
With the switch from Qt5 to Qt6, many settings related to a high-dpi resolution were changed from “opt-in” to “enabled by default” or “always enabled”. For example, the Qt::ApplicationAttribute enum no longer contains the properties Qt::AA_EnableHighDpiScaling and Qt::AA_DisableHighDpiScaling (sources: Qt5, Qt6), which can be used to control the scaling behaviour for the entire application.

However, most standard Qt UI elements handle this well by default, details can be found in this documentation page.
On the other hand, custom elements such as QImage and QPixmap do not handle this (correctly) by default (see here).

In QLC+, those elements are used to render the text labels and images/icons in the ClickAndGoWidget class.

Proposed Solution
A practical example of how to solve this issue can be found here.
However, as indicated here, using the global/application-wide devicePixelRatio may not be the ideal solution, since users may be using multiple different screens.

Furthermore, the academically clean solution would be to create a subclass of QImage and override the paintEvent method with a custom one, which takes DPI-related scaling into account.
Since QLC+ is only affected in one place by this, I chose the more practical approach, writing a “factory method” for QImage that sets all necessary parameters based on the values of the underlying parent QWidget.
The static variant of this method is used by the inner class ClickAndGoWidget::PresetResource and helps to centralise the code additions, resulting in minimal changes in existing code.

I also took the opportunity to apply the recent “initialisation list”, “final class” and “const methods” refactorings to the ClickAndGoWidget class.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 33.987% (-0.007%) from 33.994%
when pulling aa4b53f on jpue:scaling
into f54ff36 on mcallegari:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants