qt - QComboBox text colour won't change with style sheet -
i'm trying style combobox in qt5. i'm using qt creator layout , loading app-wide style sheet @ start up.
the css have related combobox follows:
qcombobox { color:white; background-color: qlineargradient(x1:0, y1:0, x2:1,y2:1, stop: 1 rgba(228, 41, 81, 100), stop: 0 rgba(234, 107, 101, 100)); border-color: rgba(255,255,255,200); border-width: 1px; border-style: solid; } qcombobox qlistview { border-style: none; background-color: qlineargradient(x1:0, y1:0, x2:1,y2:0, stop: 1 rgba(228, 41, 81, 100), stop: 0 rgba(234, 107, 101, 100)); } qcombobox::drop-down { width: 20px; border: 1px; border-color:white; border-left-style:solid; border-top-style: none; border-bottom-style: none; border-right-style: none; } qcombobox::down-arrow { image: url(:/arrowimages/images/whitearrowdown16.png); width: 16px; height: 16px; }
but text colour in combo box remainds default (black) colour. colour in drop down white. border colour , styling work correctly. label on combobox sort of sub-control need style separately? or missing else?
thanks.
edit:
added screenshots clarity
edit 2: looks occurs when combobox set not editable (which correct behaviour program, doesn't me.) when combobox set editable, obeys styles correctly. i've tried adding
qcombobox:!editable { color:white; }
but doesn't fix problem.
only resolved this. seems setting padding property (with value) on combobox in style sheet makes obey colour styling. i'm assuming it's down sort of bug might arise on set ups, if else having same problem, following code work (when compared in original question):
qcombobox { color:white; background-color: qlineargradient(x1:0, y1:0, x2:1,y2:1, stop: 1 rgba(228, 41, 81, 100), stop: 0 rgba(234, 107, 101, 100)); border-color: rgba(255,255,255,200); border-width: 1px; border-style: solid; padding: 1px 0px 1px 3px; /*this makes text colour work*/ }
Comments
Post a Comment