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. [SOLVED] Guide to make your desktop app look the same on the 3 platforms (linux, mac, windows)

[SOLVED] Guide to make your desktop app look the same on the 3 platforms (linux, mac, windows)

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 2.8k Views 1 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.
  • BlackMambaB Offline
    BlackMambaB Offline
    BlackMamba
    wrote on last edited by
    #1

    Hello,

    First is it possible?
    Second, is there a guide for that somewhere?

    Cheers,

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

      Yes, it is possible and easy. Just hard-code the style in your app, or use an external stylesheet like "QDarkStyleSheet":https://github.com/ColinDuquesnoy/QDarkStyleSheet.

      Or run your app with -style flag:
      @
      myApp.exe -style Fusion
      @

      (Z(:^

      1 Reply Last reply
      0
      • BlackMambaB Offline
        BlackMambaB Offline
        BlackMamba
        wrote on last edited by
        #3

        Thank you Mister AFAIK ;)

        1 Reply Last reply
        0
        • BlackMambaB Offline
          BlackMambaB Offline
          BlackMamba
          wrote on last edited by
          #4

          Hello again,

          In your example, there are only native widgets int he qss file. Does that work from subclassed widgets?
          (because I am having some issues by setting stylesheet in a clean way with the widgets I subclassed)

          Cheers

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            It should still work correctly, if you have not changed the widgets too much (by doing custom painting, for example).

            (Z(:^

            1 Reply Last reply
            0
            • BlackMambaB Offline
              BlackMambaB Offline
              BlackMamba
              wrote on last edited by
              #6

              Will try this thanks ;)

              1 Reply Last reply
              0
              • BlackMambaB Offline
                BlackMambaB Offline
                BlackMamba
                wrote on last edited by
                #7

                Why isn't this working when just manually change the shylesheet in the UI ?
                For example, I subclassed QPushButton with no paintEvent,
                I do on the widget containing some of these custom pushbuttons:
                MyButton{
                background-color : black
                }
                This is not working. Why would there be difference between this and qss file?

                1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #8

                  I don't know exactly how you assign the stylesheet.
                  Is "MyButton" the name of your subclass?

                  (Z(:^

                  1 Reply Last reply
                  0
                  • BlackMambaB Offline
                    BlackMambaB Offline
                    BlackMamba
                    wrote on last edited by
                    #9

                    Hello again. Yes it is my subclass.
                    Here is how I proceed :
                    In the ui file, I have one widget with layout. I add several QPushButton to this layout. Then I cast these QPushButton into MYCustomButton class by right clicking in the UI and chosing cast into MyCustomButton.
                    THen when I right click on the widget and do
                    MyButton{
                    background-color : black
                    }
                    nothing is happening.

                    1 Reply Last reply
                    0
                    • sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      Then use this:
                      @
                      MyCustomButton{
                      background-color : black
                      }
                      @

                      I remember there were some problems with "overwriting" stylesheets (that is, when one global QSS is specified, in some cases further style changes in children will fail). Maybe you have hit a bug. Try setting that new style in C++, and if that fails: add it to the global QSS file.

                      (Z(:^

                      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