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. use of colors/palettes/stylesheets
Forum Updated to NodeBB v4.3 + New Features

use of colors/palettes/stylesheets

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 6 Posters 7.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.
  • kshegunovK kshegunov

    What OS is this? Because some systems doesn't use the palette for some of the painting and it's kind of messy. Alternatively, you could try to set a stylesheet to your app.

    mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #3

    @kshegunov I'm developing on Windows 10, but any solution needs to work across platforms. Does this mean I need to use stylesheets? Somehow, I had assumed that Qt would give me a little more control over this.

    A kshegunovK 2 Replies Last reply
    0
    • mzimmersM mzimmers

      @kshegunov I'm developing on Windows 10, but any solution needs to work across platforms. Does this mean I need to use stylesheets? Somehow, I had assumed that Qt would give me a little more control over this.

      A Offline
      A Offline
      alex_malyu
      wrote on last edited by alex_malyu
      #4

      @mzimmers
      If you want just colors - palette will work most of the time , at least for desktop systems,
      but you will have to test application on the system you want to support anyway.

      Stylesheets give additional controls (shapes, positioning, metc ) , but not all widgets and aspects can be customized.
      And this likely will not be ever fixed - due QWidget development status.
      In this case you will need customize QWidgets painting for the affected widgets.

      Warning! Palettes and stylesheet do not play together well, choose one or go QML and define everything yourself.

      mzimmersM 1 Reply Last reply
      2
      • A alex_malyu

        @mzimmers
        If you want just colors - palette will work most of the time , at least for desktop systems,
        but you will have to test application on the system you want to support anyway.

        Stylesheets give additional controls (shapes, positioning, metc ) , but not all widgets and aspects can be customized.
        And this likely will not be ever fixed - due QWidget development status.
        In this case you will need customize QWidgets painting for the affected widgets.

        Warning! Palettes and stylesheet do not play together well, choose one or go QML and define everything yourself.

        mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #5

        @alex_malyu thanks for the input. I'll look through the examples to see if I can find anything similar to what I want to do, and probably come back with more questions.

        Is there an unofficial guideline for when to use CSS vs. palettes?

        Venkatesh VV 1 Reply Last reply
        0
        • mzimmersM mzimmers

          @kshegunov I'm developing on Windows 10, but any solution needs to work across platforms. Does this mean I need to use stylesheets? Somehow, I had assumed that Qt would give me a little more control over this.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #6

          @mzimmers said in use of colors/palettes:

          Does this mean I need to use stylesheets?

          Most probably, but someone might prove me wrong.

          Is there an unofficial guideline for when to use CSS vs. palettes?

          Not that I'm aware of. Perhaps you could try the wiki?

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          2
          • mzimmersM mzimmers

            @alex_malyu thanks for the input. I'll look through the examples to see if I can find anything similar to what I want to do, and probably come back with more questions.

            Is there an unofficial guideline for when to use CSS vs. palettes?

            Venkatesh VV Offline
            Venkatesh VV Offline
            Venkatesh V
            wrote on last edited by
            #7

            Hi
            @mzimmers

            i would prefer you to use stylesheet for this as it provides you all the properties like button hover etc.
            for example
            button.setstylesheet("QPushButton{"
            "border: 1px solid #333333;"
            "color: rgb(212, 212, 212);"
            "font-size:10pt;"
            "Text-align:left;"
            "border-radius: 2px;"
            "background-color: #116a06;"
            "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
            "stop: 0 #444444, stop: 1 #222222);"
            "}"
            "QPushButton:pressed {"
            "border: 1px solid #333333;"
            "color: rgb(212, 212, 212);"
            "Text-align:left;"
            "background-color: #222222;"
            "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.67, "
            "stop: 0 #444444, stop: 1 #222222);"
            "}";)

            1 Reply Last reply
            4
            • Venkatesh VV Offline
              Venkatesh VV Offline
              Venkatesh V
              wrote on last edited by
              #8

              Hi @mzimmers

              if you got solution, please mark it as solved.

              mzimmersM 1 Reply Last reply
              1
              • Venkatesh VV Venkatesh V

                Hi @mzimmers

                if you got solution, please mark it as solved.

                mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #9

                @Venkatesh-V I still need to do some more looking at palettes before I close this topic. Thanks for your contribution, though. It was very helpful.

                1 Reply Last reply
                1
                • M Offline
                  M Offline
                  mostefa
                  wrote on last edited by
                  #10

                  Hi @mzimmers

                  For me ,i highly recommend you using stylesheet instead of palette ,

                  Stylesheet is really simple to use , and is more flexible if you want to other features , to the style of your UI.

                  You can also see what the Qt Doc says about that :

                  Style sheets let you perform all kinds of customizations that are difficult or impossible to perform using QPalette alone. If you want yellow backgrounds for mandatory fields, red text for potentially destructive push buttons, or fancy check boxes, style sheets are the answer.

                  mzimmersM 1 Reply Last reply
                  1
                  • M mostefa

                    Hi @mzimmers

                    For me ,i highly recommend you using stylesheet instead of palette ,

                    Stylesheet is really simple to use , and is more flexible if you want to other features , to the style of your UI.

                    You can also see what the Qt Doc says about that :

                    Style sheets let you perform all kinds of customizations that are difficult or impossible to perform using QPalette alone. If you want yellow backgrounds for mandatory fields, red text for potentially destructive push buttons, or fancy check boxes, style sheets are the answer.

                    mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #11

                    @mostefa I think I'm going to do just that. I've been playing with stylesheets, and so far they meet my (modest) needs. Thanks.

                    1 Reply Last reply
                    1
                    • webzoidW Offline
                      webzoidW Offline
                      webzoid
                      wrote on last edited by
                      #12

                      I’ll add my two pence (or cents) and say that I’ve extensively used style sheets throughout my Qt Widgets application and the results have been excellent.

                      I’ve been able to successfully apply styles to 70% of the standard widgets with the other 30% needing just a little tweaking.

                      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