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. Change stylesheet
Qt 6.11 is out! See what's new in the release blog

Change stylesheet

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.5k 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.
  • C Offline
    C Offline
    chikymanzanares
    wrote on last edited by
    #1

    Hi,

    I don't know how to change the GUI style.

    I push the right button on, for example, a listWidget, I push change stylesheet. I write

    @
    QScrollBar:vertical {
    border: 2px solid grey;
    background: #32CC99;
    height: 15px;
    margin: 0px 20px 0 20px;
    }
    QScrollBar::handle:vertical {
    background: white;
    min-width: 20px;
    }
    QScrollBar::add-line:vertical {
    border: 2px solid grey;
    background: #32CC99;
    width: 20px;
    subcontrol-position: right;
    subcontrol-origin: margin;
    }

    QScrollBar::sub-line:vertical {
    border: 2px solid grey;
    background: #32CC99;
    width: 20px;
    subcontrol-position: left;
    subcontrol-origin: margin;
    }
    @

    I run, but the style don't change. Should I do something more?

    My qt versión is the following

    Qt Creator 2.1.0
    Based on Qt 4.7.1 (32 bit)

    Built on Mar 22 2011 at 13:04:36

    From revision e80bb4437c

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      If you try your code with a horizontal QScrollBar you will see the results you want.
      If you use it on a vertical one you will not.

      You probably copied the stylesheet code, which was meant for a horizontal scrollbar and tried to use it for a vertical one.

      where you use height, you should use width instead and vice versa.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chikymanzanares
        wrote on last edited by
        #3

        thanks Eddy, Now I understand. You're right in all.

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          You're welcome!

          Could you please edit your title and add [solved] in front of it?

          Qt Certified Specialist
          www.edalsolutions.be

          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