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. QSS issue about QComboBox
Forum Updated to NodeBB v4.3 + New Features

QSS issue about QComboBox

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 481 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.
  • S Offline
    S Offline
    ShannonW
    wrote on last edited by ShannonW
    #1

    For QComboBox, I want to test the QSS style settings, When I only put:

    QComboBox::drop-down
    {
        image: url(:/images/res/drop-down.png);
    }
    
    

    The result is ok, just like:
    3be528bb-ed1f-433d-9bea-c5063432ad17-image.png

    while, when I add something like this:

    QComboBox{
        border: 1px solid red;
    
        font-size: 12px;
    
    }
    
    QComboBox::drop-down
    {
        image: url(:/images/res/drop-down.png);
    }
    
    

    The result is not what I imagined:
    505244a8-0a40-4316-b488-279b3b54305e-image.png

    Here is my picture:
    drop-down.png

    So, why is the result like this?

    sierdzioS 1 Reply Last reply
    0
    • S ShannonW

      For QComboBox, I want to test the QSS style settings, When I only put:

      QComboBox::drop-down
      {
          image: url(:/images/res/drop-down.png);
      }
      
      

      The result is ok, just like:
      3be528bb-ed1f-433d-9bea-c5063432ad17-image.png

      while, when I add something like this:

      QComboBox{
          border: 1px solid red;
      
          font-size: 12px;
      
      }
      
      QComboBox::drop-down
      {
          image: url(:/images/res/drop-down.png);
      }
      
      

      The result is not what I imagined:
      505244a8-0a40-4316-b488-279b3b54305e-image.png

      Here is my picture:
      drop-down.png

      So, why is the result like this?

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

      You probably need to set width and height of the drop-down.

      (Z(:^

      S 1 Reply Last reply
      0
      • sierdzioS sierdzio

        You probably need to set width and height of the drop-down.

        S Offline
        S Offline
        ShannonW
        wrote on last edited by ShannonW
        #3

        @sierdzio So why it is ok when I do not add QComboBox {} block? And I also add width and height like:

        QComboBox
        {
            border: 1px solid red;
            font-size: 12px;
        }
        
        QComboBox::drop-down
        {
        	width 20;
        	height 20;
        	image: url(drop-down.png);
        }
        

        It not work, The result keeps like:
        2c8f6342-90e8-4de3-a1fa-b883a0e75ab7-image.png

        sierdzioS 1 Reply Last reply
        0
        • S ShannonW

          @sierdzio So why it is ok when I do not add QComboBox {} block? And I also add width and height like:

          QComboBox
          {
              border: 1px solid red;
              font-size: 12px;
          }
          
          QComboBox::drop-down
          {
          	width 20;
          	height 20;
          	image: url(drop-down.png);
          }
          

          It not work, The result keeps like:
          2c8f6342-90e8-4de3-a1fa-b883a0e75ab7-image.png

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

          Missing colons?

          width: 20;
          height: 20;
          

          (Z(:^

          S 1 Reply Last reply
          1
          • sierdzioS sierdzio

            Missing colons?

            width: 20;
            height: 20;
            
            S Offline
            S Offline
            ShannonW
            wrote on last edited by
            #5

            @sierdzio Thanks! I did ignore the comma, and now it is ok when set width and height to 20px. Now the question is why it is ok when I do not add QComboBox {} block?

            sierdzioS 1 Reply Last reply
            0
            • S ShannonW has marked this topic as solved on
            • S ShannonW has marked this topic as unsolved on
            • S ShannonW

              @sierdzio Thanks! I did ignore the comma, and now it is ok when set width and height to 20px. Now the question is why it is ok when I do not add QComboBox {} block?

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

              @ShannonW no idea, QSS is in general quite finicky.

              (Z(:^

              S 1 Reply Last reply
              0
              • sierdzioS sierdzio

                @ShannonW no idea, QSS is in general quite finicky.

                S Offline
                S Offline
                ShannonW
                wrote on last edited by
                #7

                @sierdzio OK, thanks again. I will mark this question solved.

                1 Reply Last reply
                0
                • S ShannonW has marked this topic as solved on

                • Login

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