Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Deploying Application Created in MSVC 2019



  • 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:

    alt text

    When I run it from within MSVC 2019, it looks exactly as it did in QT Designer (launched from within MSVC 2019):

    alt text

    I then used the command-line windeployqt utility as follows ...

    alt text

    ... 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:

    alt text

    What gives? What am I doing wrong? Thank you.



  • 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.

    alt text

    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?


  • Moderators

    @168gr seems like a windows display scaling problem
    check your resolution on the different devices and the Scaling factor of "text, apps & Elements"


  • Moderators

    @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".



  • @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% 1920x1080

    Changed 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).


  • Moderators

    @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 😉



  • @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.


Log in to reply