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

Stylesheet for qcombobox

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

    How do I write stylesheet selector to change background of QComboBox's QLineEdit? I tried this:
    a) QComboBox {background-color: rgb(255, 192, 192);} - it restyles the drop down button as well which doesn't look good at all,
    b) QComboBox QLineEdit {background-color: rgb(255, 192, 192);} - doesn't change anything.

    Any other options?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      Have a look "here":http://doc.qt.nokia.com/4.7/stylesheet-examples.html#customizing-qcombobox

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomasz_grobelny
        wrote on last edited by
        #3

        Does the page say how to style QLineEdit inside QComboBox? If so, I cannot see it.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          OK, you're right sorry about that, I thought the editable was for the lineedit (instead of just indicating whether it is present or not). I didn't find a way to access the QLineEdit directly from within the stylesheet, but you have two alternatives:

          Set the background for the entire QComboBox and set it back for QComboBox::drop-down

          Use the lineEdit() function to access the lineedit and set the stylesheet directly

          Hope that helps and sorry I lead you the wrong way at first

          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