Deploying Application Created in MSVC 2019
-
wrote on 2 Dec 2019, 10:21 last edited by
I have a fairly simple application, that I created in Microsoft Visual C++ 2019. It reads from some analog sampling hardware over a serial connection, and displays the data being read. The purpose is some physiologic monitoring of some medical hardware that is being developed.
Anyway, the application works fine when run on the computer it was developed on - both when executed from within MSVC, and when executed normally direct from the deployment folder.
When I try to deploy the completed application to another Windows computer, it runs, but the window is distorted and the application is essentially unusable.
Qt 5.13.2 is installed. MSVC 2019 has the Qt extension. I compiled/built for release:
When I run it from within MSVC 2019, it looks exactly as it did in QT Designer (launched from within MSVC 2019):
I then used the command-line windeployqt utility as follows ...
... and moved the whole folder to another computer which has the Visual C++ redistributable files installed on it (VC_redist.x64.exe straight from Microsoft). The program runs and functions, but it looks squished:
What gives? What am I doing wrong? Thank you.
-
wrote on 2 Dec 2019, 11:19 last edited by 168gr 12 Feb 2019, 11:22
Quick update - deployed to a 3rd computer. This one is a MS Surface Pro tablet.
The application runs and looks a little better, but still not quite right.
I was under the impression that a central point of Qt was that you could develop an app that looks the same across multiple platforms. But here I am on three Windows PCs and I'm getting three different looks. Is there something else I need to configure when building the application to ensure consistent look/scaling/fontsize/etc on any computer it's run on?
-
Quick update - deployed to a 3rd computer. This one is a MS Surface Pro tablet.
The application runs and looks a little better, but still not quite right.
I was under the impression that a central point of Qt was that you could develop an app that looks the same across multiple platforms. But here I am on three Windows PCs and I'm getting three different looks. Is there something else I need to configure when building the application to ensure consistent look/scaling/fontsize/etc on any computer it's run on?
@168gr seems like a windows display scaling problem
check your resolution on the different devices and the Scaling factor of "text, apps & Elements" -
I have a fairly simple application, that I created in Microsoft Visual C++ 2019. It reads from some analog sampling hardware over a serial connection, and displays the data being read. The purpose is some physiologic monitoring of some medical hardware that is being developed.
Anyway, the application works fine when run on the computer it was developed on - both when executed from within MSVC, and when executed normally direct from the deployment folder.
When I try to deploy the completed application to another Windows computer, it runs, but the window is distorted and the application is essentially unusable.
Qt 5.13.2 is installed. MSVC 2019 has the Qt extension. I compiled/built for release:
When I run it from within MSVC 2019, it looks exactly as it did in QT Designer (launched from within MSVC 2019):
I then used the command-line windeployqt utility as follows ...
... and moved the whole folder to another computer which has the Visual C++ redistributable files installed on it (VC_redist.x64.exe straight from Microsoft). The program runs and functions, but it looks squished:
What gives? What am I doing wrong? Thank you.
@168gr said in Deploying Application Created in MSVC 2019:
What gives? What am I doing wrong? Thank you.
You're probably hardcoding widget sizes. See High DPI Displays. To fix this "Replace hard-coded sizes in layouts and drawing code with values calculated from font metrics or screen size".
-
@168gr seems like a windows display scaling problem
check your resolution on the different devices and the Scaling factor of "text, apps & Elements"wrote on 2 Dec 2019, 11:53 last edited by@J-Hilk said in Deploying Application Created in MSVC 2019:
@168gr seems like a windows display scaling problem
check your resolution on the different devices and the Scaling factor of "text, apps & Elements"Thanks, that was it.
Development desktop: Scale/layout 100% 2560x1080
Laptop: Scale/layout 250% 3840x2160
Tablet: Scale/layout 150% 1920x1080Changed the laptop and tablet to 100%, and the app looks perfect.
Except ... now the app is TINY on the laptop, which is a 3840x2160 display. I mean, it's about 1/12th the screen now.
Is there some mechanism to overcome this issue and get the entire app to scale correctly, or is this just how it is?
Thanks again. I appreciate your help (and so quickly, too).
-
@J-Hilk said in Deploying Application Created in MSVC 2019:
@168gr seems like a windows display scaling problem
check your resolution on the different devices and the Scaling factor of "text, apps & Elements"Thanks, that was it.
Development desktop: Scale/layout 100% 2560x1080
Laptop: Scale/layout 250% 3840x2160
Tablet: Scale/layout 150% 1920x1080Changed the laptop and tablet to 100%, and the app looks perfect.
Except ... now the app is TINY on the laptop, which is a 3840x2160 display. I mean, it's about 1/12th the screen now.
Is there some mechanism to overcome this issue and get the entire app to scale correctly, or is this just how it is?
Thanks again. I appreciate your help (and so quickly, too).
@168gr
the link @Chris-Kawa posted should contain all the information you need to make your App High-DPI capable .Read through it, and if you have questions, don't hesitate to come back and ask 😉
-
@168gr said in Deploying Application Created in MSVC 2019:
What gives? What am I doing wrong? Thank you.
You're probably hardcoding widget sizes. See High DPI Displays. To fix this "Replace hard-coded sizes in layouts and drawing code with values calculated from font metrics or screen size".
wrote on 2 Dec 2019, 12:14 last edited by@Chris-Kawa said in Deploying Application Created in MSVC 2019:
@168gr said in Deploying Application Created in MSVC 2019:
What gives? What am I doing wrong? Thank you.
You're probably hardcoding widget sizes. See High DPI Displays. To fix this "Replace hard-coded sizes in layouts and drawing code with values calculated from font metrics or screen size".
Excellent, thank you. Setting the QT_AUTO_SCREEN_SCALE_FACTOR environment variable was an instant (if inelegant) fix. I'll look into the other options more closely. Appreciate the help.
1/7