Solved Shapes of control are shrinked on 4k displays d
-
Hi and welcome to devnet,
Your explication is not exactly clear. Can you post screen shots that shows the difference ?
By the way:
- What Qt version are you using ?
- What OS are you running ?
-
Thanks.
Here it is:
QtCreator: 4.9.0
OS: Windows 10 -
Did you already check the HighDPI chapter in Qt's documentation ?
-
Well, there is attrbute Qt::AA_EnableHighDpiScaling, that apparently resolves the problem.
How (or where) can I set it ?
Thanks. -
If you follow the link to the attribute documentation, you can find QCoreApplication::setAttribute.
-
Setting the Qt::AA_EnableHighDpiScaling attribute to true in the MainWindow constructor
didn't help: the button shape remains shrinked. -
@Pavel_47 Try to set the attribute before creating the MainWindow instance.
-
Tried. The same (i.e. button shrinked).
int main(int argc, char *argv[]){ QApplication a(argc, argv); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); MainWindow w; w.show(); return a.exec(); }
-
@Pavel_47 Is the button in a layout? How did you set it up?
-
Should be like this:
-
@Pavel_47 said in Shapes of control are shrinked on 4k displays d:
AA_EnableHighDpiScaling
As explained in the documentation of this enum, it must be set before creating a QGuiApplication instance (which is also valid for QApplication since it's based on QGuiApplication).
-
Yes ! Works. Thanks
int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }