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. QComboBox text Color with CSS
QtWS25 Last Chance

QComboBox text Color with CSS

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 6.1k Views
  • 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.
  • G Offline
    G Offline
    Gute
    wrote on last edited by
    #1

    Hi I need to change the color of a QComboBox's text in read-only I try this, but nothing happens

    @QComboBox:!editable {
    color: white;
    }@

    If I change the code for

    @QComboBox:editable {
    color: white;
    }@

    all QComboBox's text color change (read-only and writable), but I want to use differents colors in each ones

    I'm using Qt 4.6.3 in windows may be a bug

    Thanks

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      Try this in your qss:
      @
      QComboBox:read-only {
      ...
      }

      QLineEdit:editable {
      ...
      }
      @

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gute
        wrote on last edited by
        #3

        Thanks for the answer, but nothing.

        Others codes works in QComboBox:!editable, for example

        @QComboBox:!editable {
        font: bold 10pt;
        }@

        but for some reason color: white not

        I have a little clue, if the application lost focus (the entire application, not only the widget) the text become white, but when the focus is in the application again text changes his color, all the time the focus in the application is in another widget not in the QComboBox

        Any Idea?

        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