Does QWidget::width() always return width in number of pixels?
-
wrote on 18 Apr 2022, 18:52 last edited by
Hi,
I'm a little confused.
I have a monitor set to a resolution of 3840 x 2160.
When a have a full screen Qt window with a QWIdget such that the widget has maximum width (almost the entire screen), the width() function of this widget still returns only about 2530. While I expected a value close to 3840. How is that possible? -
Hi,
Any chances you have a scaling factor of 1.5 set for that screen ?
-
wrote on 18 Apr 2022, 20:44 last edited by Simmania
No,
I didn;t set anything.
When I add:painter.scale(1.0, 1.0);
the result doesn't change.
-
wrote on 19 Apr 2022, 07:43 last edited by
I tested on an other computer. With resolution 1920x1080. On that one width() returns the number of pixels correctly.
Is there some limit on screen size above which Qt is doing some scaling internally? -
No,
I didn;t set anything.
When I add:painter.scale(1.0, 1.0);
the result doesn't change.
@Simmania said in Does QWidget::width() always return width in number of pixels?:
No,
I didn;t set anything.
When I add:
painter.scale(1.0, 1.0);I think what @SGaist was asking was: is a scaling factor set in your OS for that screen?
-
wrote on 19 Apr 2022, 17:23 last edited by
Aah. Yes there was! Thx!
So that means you never can be sure the width() is expressed in pixels. Hmm. -
Aah. Yes there was! Thx!
So that means you never can be sure the width() is expressed in pixels. Hmm.@Simmania said in Does QWidget::width() always return width in number of pixels?:
So that means you never can be sure the width() is expressed in pixels
How should the OS add this scale factor otherwise?
1/7