Creating a form with the correct font for the host operating system.
-
I'm working on a project using Qt, the version of Qt and the compiler used is dictated by the client I'm contracted to:
Qt Creator 4.4.1 Based on Qt 5.9.2 (MSVC 2015, 32 bit)
I would like to create a form that will always use the correct system font and size according to the host operating system it is running on.
For the application I'm working on the host OS is Windows 10. I've chosen System Font, however the only sizes are 16 and 20 which doesn't look correct.
I want the application and its forms to look like any other application running on the host, not like its been created with non-standard look and feel.
When I drag a new label onto the form the default font used is [MS Shel DLL 2,8] which is very small compared to any font appearing in any other dialog used by other applications on the OS including Qt Creator.
Is there a selection/setup within Qt Creator that will allow me to achieve selection of the default font and correct size?
-
@SPlatten said in Creating a form with the correct font for the host operating system.:
Based on Qt 5.9.2 (MSVC 2015, 32 bit)
Just a note: this is Qt version which was used to build QtCreator. Qt version you're using can be completely different...
-
@jsulm , I'm now creating a new UI, dropped a Push Button from the palette onto the mainwindow.ui, the button is very small and the font almost unreadable, yet this is using all the defaults, nothing has been modified.
How to I get a button thats equal to the buttons as used by the dialogs in Qt Creator which look like they are the same size as every other button in the User Interface?
-
@SPlatten
Hi
Are you on a hires screen?
Does app look the same when you run it ? -
@mrjj , My screen is insane, its a 49" curved Samsung monitor, resolution is 5120x1140. No it doesn't look the same, without modifications, the button is smaller and not large enough for the font that was chosen by default. I have now resized the button and font, but I didn't think I would have to do this?
-
@SPlatten
well im asking if it scales as it should ? buttons and menus etc are ok size ?
(not in the UI i mean, but the creator app itself)
Qt 5.9 is pretty old but i think hi res support came in 5.6
but been tweaked in later versions.well normally one would put all buttons etc in layouts and when app run it should look "normal"
however, you should check ifint main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <-- enable it QGuiApplication app(argc, argv);
makes any difference.
-
@mrjj Thank you, but I'm not sure how this helps, because as I see it there are two problems here:
- Qt Creator doesn't select the correct font by default when designing the WYSIWYG interface.
- At runtime the font is different from that used when designing the interface.
-
@SPlatten
Yep but its how it is with hi res display and fonts.
I highly recommend you read the link to gain an overview.You might need to tweak the settings for it to look normal on that screen.
Must be nice with 5k desktop :)