Interface adaptive screen resolution
-
I followed the online tutorial and added QCoreApplication: setAttribute (Qt:: AA-EnableHighDpiScaling) to the code; This statement reveals that the interface will exceed the screen size the first time it is opened (the interface size is 1920 * 180, and the screen resolution is 2560 * 1440), and then it can be perfectly adapted to the small resolution interface (the small resolution screen is 1920 * 1080)
-
Hi and welcome to devnet,
What is you question ?
-
@SGaist said in Interface adaptive screen resolution:
Hi and welcome to devnet,
What is you question ?
How Interface adaptive screen resolution in QT?
Now I do somethingt to solve,but unsuccess. Example, I followed the online tutorial and added QCoreApplication: setAttribute (Qt:: AA-EnableHighDpiScaling) to the code; This statement reveals that the interface will exceed the screen size the first time it is opened (the interface size is 1920 * 180, and the screen resolution is 2560 * 1440), and then it can be perfectly adapted to the small resolution interface (the small resolution screen is 1920 * 1080). -
@SGaist said in Interface adaptive screen resolution:
Hi and welcome to devnet,
What is you question ?
How Interface adaptive screen resolution in QT?
Now I do somethingt to solve,but unsuccess. Example, I followed the online tutorial and added QCoreApplication: setAttribute (Qt:: AA-EnableHighDpiScaling) to the code; This statement reveals that the interface will exceed the screen size the first time it is opened (the interface size is 1920 * 180, and the screen resolution is 2560 * 1440), and then it can be perfectly adapted to the small resolution interface (the small resolution screen is 1920 * 1080).@PhillLi The Qt5 Qt::AA_EnableHighDPI attribute controls whether the application adapts for the pixel density of a display using an approach matched to the operating system involved. This density is not only related to the total pixel horizontal X vertical i.e., the screen resolution.
It appears you are expecting that this will scale your application UI to occupy either the whole available screen or some fixed portion of it. This is not the purpose of the flag.
Perhaps you can share with us:
- which online tutorial you were following, and
- what statement you are referring to.
-
@PhillLi The Qt5 Qt::AA_EnableHighDPI attribute controls whether the application adapts for the pixel density of a display using an approach matched to the operating system involved. This density is not only related to the total pixel horizontal X vertical i.e., the screen resolution.
It appears you are expecting that this will scale your application UI to occupy either the whole available screen or some fixed portion of it. This is not the purpose of the flag.
Perhaps you can share with us:
- which online tutorial you were following, and
- what statement you are referring to.
-
@ChrisW67 I just hope to achieve Qt interface that can adapt to screens of different resolutions, but now I don't know how to solve this or what methods can be used to implement it
@PhillLi said in Interface adaptive screen resolution:
screens of different resolutions, but now I don't know how to solve this or what methods can be used to implement it
Use a proper layout.
-
@ChrisW67 I just hope to achieve Qt interface that can adapt to screens of different resolutions, but now I don't know how to solve this or what methods can be used to implement it
-
@PhillLi said in Interface adaptive screen resolution:
hope
I used the method QCoreApplication: setAttribute (Qt:: AA Enable High DpiScaling), but the actual effect was not reasonable enough