Results 1 to 6 of 6

Thread: Qt Application looks different after being installed in Windows

  1. #1
    Join Date
    Nov 2014
    Posts
    35
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt Application looks different after being installed in Windows

    Hello,

    I'm developing an application for Windows that uses Qt 5.10 and is compiled with Visual Studio 2015, and I'm using NSIS to pack and build the installer.

    When I run the application that I have installed to the "c:\Program Files" directory it looks different than the application that I run from the build directory.

    This is how it looks when I run it from the build directory:

    p5Uqqdq.png

    And this is how it looks when I run it from the "c:\Program Files" directory after it has been installed:

    tBHaeyN.png

    As you can see, the installed instance has something like a Windows XP look, with 3D buttons and frames.

    Does anybody know what could be happening? Or has a hint of what to look for?

    Thank you in advance for your help!
    pixaeiro
    http://www.pixaflux.com
    Non-destructive Image Editor

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt Application looks different after being installed in Windows

    It looks like the default style used in your build environment is different from that used in your installed runtime environment. Does it look different in your build environment when you run Debug vs. Release mode builds?

    You can also look at your Output window in Visual Studio when you run in debug mode. It will show a list of all of the DLLs loaded. In my system, it shows this for the style plugin:

    'MyApp.exe' (Win32): Loaded 'C:\Qt\5_11_1\5.11.1\msvc2015_64\plugins\styles\qw indowsvistastyled.dll'
    I am not sure how you can determine which style plugin is being loaded when you are running your installed app. Maybe you can retrieve the QStyle instance for qApp, then query the static QMetaObject for its className()?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Nov 2014
    Posts
    35
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Application looks different after being installed in Windows

    Hello d_stranz,

    Thank you very much for your reply!

    Following your instructions I tested the configuration of my application and I found that if I delete the qt.conf file in the installed directory my application looks the same as in the build directory (Windows 10).

    My application has a qt.conf file that tells Qt where to find the plugins:

    Qt Code:
    1. [Paths]
    2. Plugins=qt_plugins
    To copy to clipboard, switch view to plain text mode 

    And I have two files in this directory:
    C:\Program Files\PixaFlux\qt_plugins\imageformats\qico.dll
    C:\Program Files\PixaFlux\qt_plugins\platforms\qwindows.dll

    I copy these two files from the Qt library path:
    E:\Libraries\Qt\5.10.1\5.10.1\msvc2015_64\plugins

    When I update to a new Qt library build I go to Qt downloads and grab one of the prebuilt libraries:
    This is the latest I downloaded
    https://download.qt.io/official_rele...t/5.10/5.10.1/ file qt-opensource-windows-x86-5.10.1.exe

    Unfortunately my Visual Studio doesn't display the Qt libraries it loads. Is there a flag I need to enable for this?

    Do you think I need to modify the qt.conf file to make my application look with flat Windows 10 widgets?

    Thank you again!


    Added after 7 minutes:


    Oh! My application was not including the style plugin!!!

    I copied the plugin you said to the qt_plugins directory and now everything looks fancy again:

    C:\Program Files\PixaFlux\qt_plugins\styles\qwindowsvistastyl e.dll

    Thank you very much!!!
    Last edited by pixaeiro; 31st December 2018 at 15:49.
    pixaeiro
    http://www.pixaflux.com
    Non-destructive Image Editor

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Application looks different after being installed in Windows

    On Windows You have a tool : windeployqt.exe.

  5. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt Application looks different after being installed in Windows

    Unfortunately my Visual Studio doesn't display the Qt libraries it loads. Is there a flag I need to enable for this?
    Sure it does. When you run your program in debug mode, open the window named "Output". If you don't see it, use View -> Output from the menu to open it. As your program runs, all of the DLLs it loads and unloads will be displayed there.

    On Windows You have a tool : windeployqt.exe.
    This is for building installers, right? The OP is using NSIS, which works just fine for Qt applications.

    For statically analyzing the runtime dependencies in a Windows program, there is the old "depends" program. This may not work to identify dynamically loaded plugins like styles, but does find the dependencies for link libraries.

    I copied the plugin you said to the qt_plugins directory and now everything looks fancy again
    Just remember to add it to your NSIS script.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  6. #6
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Application looks different after being installed in Windows

    Quote Originally Posted by d_stranz View Post
    This is for building installers, right?.
    No, it scans the executable and copies all needed Qt dlls and plugins to a dedicated directory so they can be used with an installer: http://doc.qt.io/qt-5/windows-deployment.html

  7. The following user says thank you to ChristianEhrlicher for this useful post:

    d_stranz (1st January 2019)

Similar Threads

  1. Replies: 6
    Last Post: 4th December 2015, 20:00
  2. Replies: 2
    Last Post: 25th November 2014, 02:27
  3. Replies: 2
    Last Post: 5th July 2014, 11:51
  4. Replies: 4
    Last Post: 27th October 2013, 06:25
  5. Qt Library installed in windows 7 32bit
    By kiboi in forum Newbie
    Replies: 1
    Last Post: 10th October 2012, 03:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.