Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why a GUI looks different on different Windows versions?
Forum Updated to NodeBB v4.3 + New Features

Why a GUI looks different on different Windows versions?

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 5 Posters 5.8k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Flavio Mesquita
    wrote on last edited by
    #1

    Hy everyone,
    I did a GUI under windows 7, everything works and looks fine, but when I run it under windows 10 it looks ugly, I mean, the background is not grey , it is white, and I can barely see the buttons and spinboxes since there is almost no contrast. Why does it happens? What can I do to avoid it? I wonder what i would look like if I run it on Linux...

    joeQJ 1 Reply Last reply
    1
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Which Qt version are you using? Perhaps it is some oldie from before Windows 10 release?

      (Z(:^

      F 1 Reply Last reply
      0
      • F Flavio Mesquita

        Hy everyone,
        I did a GUI under windows 7, everything works and looks fine, but when I run it under windows 10 it looks ugly, I mean, the background is not grey , it is white, and I can barely see the buttons and spinboxes since there is almost no contrast. Why does it happens? What can I do to avoid it? I wonder what i would look like if I run it on Linux...

        joeQJ Offline
        joeQJ Offline
        joeQ
        wrote on last edited by
        #3

        @Flavio-Mesquita
        Hi, friend. welcome.

        Different system has the different windows, dialog, and button ... styles.

        Qt default used the system style.

        When you using Qt Widget in Win7, Qt default use Win7 Dialog style.
        When you using Qt Widget in Win10, Qt default use Win10 Dialog style.
        and also has Mac system,Ubuntu system, They are both different.

        If you want to uniform style of widgets in different system.

        The only way is to repaint widget, like subclass QWidget,, or use QSS.

        more information, please to see Qt help manual.

        like QPushButton QTabWidget QLabel ... Widget class.

        Just do it!

        F 1 Reply Last reply
        2
        • sierdzioS sierdzio

          Which Qt version are you using? Perhaps it is some oldie from before Windows 10 release?

          F Offline
          F Offline
          Flavio Mesquita
          wrote on last edited by
          #4

          @sierdzio Hi, I used Qt creator 4.6.1, with Qt5.10. I downloaded it about a month ago.

          sierdzioS 1 Reply Last reply
          0
          • F Flavio Mesquita

            @sierdzio Hi, I used Qt creator 4.6.1, with Qt5.10. I downloaded it about a month ago.

            sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            @Flavio-Mesquita said in Why a GUI looks different on different Windows versions?:

            @sierdzio Hi, I used Qt creator 4.6.1, with Qt5.10. I downloaded it about a month ago.

            OK that is recent enough.

            When you say you run it under Windows 10, does it mean you compile it on Win10, or compile on Win7 and copy the .exe file to Win10, then open?

            If the latter, then check out https://doc.qt.io/qt-5/windows-deployment.html

            (Z(:^

            F 1 Reply Last reply
            2
            • sierdzioS sierdzio

              @Flavio-Mesquita said in Why a GUI looks different on different Windows versions?:

              @sierdzio Hi, I used Qt creator 4.6.1, with Qt5.10. I downloaded it about a month ago.

              OK that is recent enough.

              When you say you run it under Windows 10, does it mean you compile it on Win10, or compile on Win7 and copy the .exe file to Win10, then open?

              If the latter, then check out https://doc.qt.io/qt-5/windows-deployment.html

              F Offline
              F Offline
              Flavio Mesquita
              wrote on last edited by
              #6

              @sierdzio I had already looked at he document you referenced and compiled it on windows 7. Used the windeployqt, that copied all the dependency files to the folder. Then I copied the whole folder with the .exe file together and put it in a computer with windows 10. When clicking on .exe file it executes, but looks weird.

              I did like said in the document:

              "The tool can be found in QTDIR/bin/windeployqt. It takes an .exe file or a directory that contains an .exe file as an argument, and scans the executable for dependencies. If a directory is passed with the --qmldir argument, windeployqt uses the qmlimportscanner tool to scan QML files inside the directory for QML import dependencies. Identified dependencies are then copied to the executable's directory. The hardcoded local paths in Qt5Core.dll are furthermore replaced with relative ones.

              For Windows desktop applications, the required runtime files for the compiler are also copied to the deployable folder by default (unless the option --no-compiler-runtime is specified). In the case of release builds using Microsoft Visual C++, these consist of the Visual C++ Redistributable Packages, which are intended for recursive installation by the application's installer on the target machine. Otherwise, the shared libraries of the compiler runtime are used."

              1 Reply Last reply
              1
              • joeQJ joeQ

                @Flavio-Mesquita
                Hi, friend. welcome.

                Different system has the different windows, dialog, and button ... styles.

                Qt default used the system style.

                When you using Qt Widget in Win7, Qt default use Win7 Dialog style.
                When you using Qt Widget in Win10, Qt default use Win10 Dialog style.
                and also has Mac system,Ubuntu system, They are both different.

                If you want to uniform style of widgets in different system.

                The only way is to repaint widget, like subclass QWidget,, or use QSS.

                more information, please to see Qt help manual.

                like QPushButton QTabWidget QLabel ... Widget class.

                F Offline
                F Offline
                Flavio Mesquita
                wrote on last edited by Flavio Mesquita
                #7

                @joeQ what do u mean by QSS?

                aha_1980A 1 Reply Last reply
                0
                • F Flavio Mesquita

                  @joeQ what do u mean by QSS?

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Flavio-Mesquita said in Why a GUI looks different on different Windows versions?:

                  @joeQ what do u mean by QSS?

                  Probably Style Sheets

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  2
                  • F Offline
                    F Offline
                    Flavio Mesquita
                    wrote on last edited by
                    #9

                    Hy guys I ended up using as the example at the documentation:
                    QApplication::setStyle(QStyleFactory::create("Fusion"));
                    just added this line on the main.cpp, it worked fine.

                    Just one more question, I want to add a logo on the widget, it works fine on my computer, but if I want it to load on another computer do i have to create a folder with the same address as it was on my computer and put the image.png there?

                    mrjjM 1 Reply Last reply
                    0
                    • F Flavio Mesquita

                      Hy guys I ended up using as the example at the documentation:
                      QApplication::setStyle(QStyleFactory::create("Fusion"));
                      just added this line on the main.cpp, it worked fine.

                      Just one more question, I want to add a logo on the widget, it works fine on my computer, but if I want it to load on another computer do i have to create a folder with the same address as it was on my computer and put the image.png there?

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #10

                      @Flavio-Mesquita said in Why a GUI looks different on different Windows versions?:

                      Just one more question, I want to add a logo on the widget, it works fine on my computer, but if I want it to load on another computer do i have to create a folder with the same address as it was on my computer and put the image.png there?

                      Hi, it would be far better to put logo in resource file so its included in the exe.

                      http://doc.qt.io/qt-5/resources.html

                      http://www.bogotobogo.com/Qt/Qt5_Resource_Files.php

                      1 Reply Last reply
                      1
                      • F Offline
                        F Offline
                        Flavio Mesquita
                        wrote on last edited by
                        #11

                        @mrjj Thanks for the answer, that is what I like about this community, u guys are always willing to help noobs like me. I did what u pointed , it works fine, still gives a warning like below, but it works. Thank u very much.

                        C:\Users\Flavio\Documents\qtTest\interface2_v2\main.cpp:9: warning: label 'read' defined but not used [-Wunused-label]
                        read:(":/logo/uff.png");
                        ^

                        mrjjM m4l490nM 2 Replies Last reply
                        0
                        • F Flavio Mesquita

                          @mrjj Thanks for the answer, that is what I like about this community, u guys are always willing to help noobs like me. I did what u pointed , it works fine, still gives a warning like below, but it works. Thank u very much.

                          C:\Users\Flavio\Documents\qtTest\interface2_v2\main.cpp:9: warning: label 'read' defined but not used [-Wunused-label]
                          read:(":/logo/uff.png");
                          ^

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Well we love beginners here :)
                          I think it says you have a variable you dont use.
                          Anywhow, just to be clear
                          iF you have a QLabel to show logo in. ( not sure what widget you have)
                          Then you can do
                          Label->setPixmap( QPixmap(":/logo/uff.png"));

                          Not sure what read: is :)

                          F 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            Well we love beginners here :)
                            I think it says you have a variable you dont use.
                            Anywhow, just to be clear
                            iF you have a QLabel to show logo in. ( not sure what widget you have)
                            Then you can do
                            Label->setPixmap( QPixmap(":/logo/uff.png"));

                            Not sure what read: is :)

                            F Offline
                            F Offline
                            Flavio Mesquita
                            wrote on last edited by Flavio Mesquita
                            #13

                            @mrjj on the example about the resources, besides adding the resource file to the project we had to add a line with the read command pointing to the logo path at the main.cpp file. maybe it was not necessary since I had the code implementing it under the interface.cpp as u mentioned.
                            Thanks anyway, soon I will come up with lots of more projects since I´m pushing to my teachers at the college to use Qt as our main tool for GUI development classes in the next semester.

                            mrjjM 1 Reply Last reply
                            0
                            • F Flavio Mesquita

                              @mrjj on the example about the resources, besides adding the resource file to the project we had to add a line with the read command pointing to the logo path at the main.cpp file. maybe it was not necessary since I had the code implementing it under the interface.cpp as u mentioned.
                              Thanks anyway, soon I will come up with lots of more projects since I´m pushing to my teachers at the college to use Qt as our main tool for GUI development classes in the next semester.

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @Flavio-Mesquita
                              Sounds not needed but not 100% sure what you do with it.
                              I guess my point was if you can use QPixmap/QImage directly, you dont need QFile or anything like that.

                              Oh, that sounds like a great plan. I hope he will.

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved