Qt GUI theme looks old-fashioned

后端 未结 4 1666
有刺的猬
有刺的猬 2021-02-12 18:54

When I cross-compile Qt 5.8.0 from source myself and use it to build the Qt \"Dynamic Layouts\" example from Qt Widgets for Microsoft Windows, it looks old-fashioned, as if it w

4条回答
  •  长发绾君心
    2021-02-12 19:15

    If you look in the src/widgets/configure.json file from Qt 5.8.0, you can see that it checks for the existence of uxtheme.h, and that uxtheme.h is a precondition for compiling the windowsxp style, which is a precondition for compiling the windowsvista style. By looking in Qt's config.log, I saw that the uxtheme.h test failed. I am not sure why, but it's probably because uxtheme.h cannot be included on its own; you need to include windows.h beforehand. I verified that the windowsxp and windowsvista styles were indeed not enabled by looking in the src/widgets/qtwidgets-config.pri file after configuring Qt. It has a list of styles that are going to get compiled, and windowsvista is not the list.

    I tried adding the -style-windowsxp -style-windowsvista options to Qt's configure command, but those options just cause errors because the uxtheme.h test is failing and it is a prerequisite for compiling those themes.

    My solution was to apply this patch to Qt 5.8.0 to skip the uxtheme test altogether:

    diff -ur qt58-orig/src/widgets/configure.json qt58/src/widgets/configure.json
    --- qt58-orig/src/widgets/configure.json        2017-05-28 02:07:07.625626151 -0700
    +++ qt58/src/widgets/configure.json     2017-06-27 21:25:52.752628339 -0700
    @@ -28,11 +28,6 @@
         },
    
         "tests": {
    -        "uxtheme": {
    -            "label": "uxtheme.h",
    -            "type": "files",
    -            "files": [ "uxtheme.h" ]
    -        }
         },
    
         "features": {
    @@ -57,7 +52,7 @@
             },
             "style-windowsxp": {
                 "label": "WindowsXP",
    -            "condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme",
    +            "condition": "features.style-windows && config.win32 && !config.winrt",
                 "output": [ "styles" ]
             },
             "style-windowsvista": {
    

    I'm not sure why the MSYS2 package worked well, since I don't see any patch like this in their build script.

提交回复
热议问题