Screen design problems
-
I'm working on an application, I have two screens, my super wide screen (5120 x 1440) and the laptop (1920 x 1080).
The application main window has a minimum size of 1200x800, on the main display everything fits fine:
On the laptop display:
It looks like a different font is being used and as a result, very little fits. The language is French.
Is there anyway I can ensure that a smaller font that will fit is used?
-
Hi again....
Regarding your font: Your application seems to fall back to the system's default font. You can set it to a specific font manually, which has to be available (on the respective machine or deployed as a resource within your executable). You can set the font on a widget or application level.QFont F("Helvetica"); // get a font from the OS F.setStretch(QFont::Unstretched); // in case you do not want it to stretch yourWidget->setFont(F); // assign the font to a widget QApplication::setFont(F); // assign it for the entire application (in your constructor or even main.cpp);
Regarding the overlap on your laptop:
Are you using layouts or have you just placed the widgets on the main window?
It looks like at least the objects under "Localisation reelle" and "Marquages stagiere" are not part of a layout. That is why they don't move or resize when your screen size changes.
Can you post the code where you build your screen? Or a screenshot of Qt designer if you use it? -
@AxelVienna , thank you, these are two displays connected to the same system, if I start the application on the large display it looks fine, if I start he application on the laptop display it doesn't.
All the text shown are added to layouts. The addition of widgets to the layouts is all via code, the two you refer to are custom widgets written by myself.
-
@AxelVienna I would like to report the font's being used, just something like:
qDebug() << fontInfo.family(); qDebug() << fontInfo.pixelSize(); qDebug() << fontInfo.pointSize();
So I can verify what is being used and its size.
-
@SPlatten said in Screen design problems:
@AxelVienna I would like to report the font's being used, just something like:
qDebug() << fontInfo.family(); qDebug() << fontInfo.pixelSize(); qDebug() << fontInfo.pointSize();
So I can verify what is being used and its size.
Good idea...
-
Well, if everything is the same on both screens, the issue is screen scaling on desktop level as @artwaw correctly said. You will find it out by trying a totally different executable, e.g. Microsoft Excel and see if it behaves the same.
@SPlatten: Regarding your homemade widgets, my suspicion is that they simply do not resize. This can result from multiple reasons, including that no resize methods have been implemented for them.
-
@AxelVienna The widgets are in the correct position and size on each render, the only issue is the text labels in the QGroupBoxes which appear to small for the labels.
-
@SPlatten: Okay. My suspicion comes from the fact that their headings do not seem to be centered. "Marquage Stagaire" right from the center. Which kind of layout does the QGroupBox "Stagaire" have? And what is the size policy of the QComboBox next to "Stagaire a voir"?
-
@AxelVienna , those widgets don't use layouts at all, they are rendered to an offscreen painter then copied as an image to the visible area.
-
@artwaw said in Screen design problems:
Looking at that link it shows;
<application> -platform windows:dpiawareness=0,1,2
How does this translate into an entry in the qt.conf file? I've added:
[Platforms]
Not sure what the actual configuration should look like.
[edit] I found something online, not sure if its correct, have edited qt.conf in C:\Qt\Qt5.9.2\5.9.2\msvc2015_64\bin\qt.conf:
[Platforms] WindowsArguments = dip awareness = 0
-
@artwaw said in Screen design problems:
Thank you, I've also used the command line option:
-platform windows:dipawareness=0
Which works.