QComboBox stylesheet
-
hi ich kriegs nich hin die farbe von den einträgen in der combobox zu verändern
also wenn man die box anklickt und die ganzen einträge herauskommen will ich den
background und schriftfarbe anpassen aber irgendwie gehts bei mir net
weiß jemand wie man die per stylesheet verändern?
-
Willst du es per QStyle oder mit einer qss Datei machen?
-
hab das mit dem Designer gemacht
QComboBox { border: 0px; padding: 1px 18px 1px 3px; min-width: 6em; color: #a4a4a4; } QComboBox:editable { background: #4c4c4c; } QComboBox:!editable, QComboBox::drop-down:editable { background-image: url(:/bilder/image/comboBoxBg.png); background-repeat: repeat-x; } /* QComboBox gets the "on" state when the popup is open */ QComboBox:!editable:on, QComboBox::drop-down:editable:on { background-image: url(:/bilder/image/comboBoxBg.png); background-repeat: repeat-x; } QComboBox:on { /* shift the text when the popup opens */ padding-top: 3px; padding-left: 4px; } QComboBox::drop-down { background: #1a1a1a; subcontrol-origin: padding; subcontrol-position: top right; width: 15px; border: 1px solid #000000; } QComboBox::down-arrow { image: url(:/bilder/image/comboBoxArrow.png); } QComboBox::down-arrow:on { /* shift the arrow when popup is open */ top: 1px; left: 1px; }
hab ich grad drin
-
Ich bin mir jetzt nicht sicher, aber ich glaube in der QComboBox fehlt dir noch das hier:
selection-color: farbe; selection-background-color: farbe;
-
habs bei QComboBox am ende eingefügt aber verändert hat sich nichts
-
Ich zeig dir mal meine qss Datei, dann siehst du ja an was es liegen könnte.
Mit der Datei spiele ich grad rum, also nicht auf die Farben achten.Wobei ich dazu sagen muss das ich auch grad Probleme mit qss habe, allerdings anders gelagert.
QDialog { background-image: url(:/images/logo_normal.png); background-repeat: no-repeat; background-position: center; background-color: #4c4c4c; } QLabel { font: 12pt; color: rgb(255, 255, 255); } QComboBox:editable, QLineEdit, QListView { color: rgb(64, 191, 64); background-color: rgb(255, 255, 241); selection-color: white; selection-background-color: rgb(76, 76, 76); border: 2px groove gray; border-radius: 10px; padding: 2px 4px; } QListView { padding: 5px 4px; } QComboBox:!editable, QPushButton { color: white; font: bold 10pt; border-image: url(:/images/button.png) 16; border-width: 16px; padding: -16px 0px; min-height: 32px; min-width: 60px; } QComboBox:!editable:hover, QComboBox::drop-down:editable:hover, QPushButton:hover { border-image: url(:/images/button-hover.png) 16; } QComboBox:!editable:on, QPushButton:pressed { color: lightgray; border-image: url(:/images/button-pressed.png) 16; padding-top: -15px; padding-bottom: -17px; } QComboBox::down-arrow { image: url(:/images/down-arrow.png); } QComboBox::down-arrow:on { top: 1px; } QComboBox * { font: 9pt; } QComboBox::drop-down:!editable { subcontrol-origin: padding; subcontrol-position: center right; width: 11px; height: 6px; background: none; } QComboBox:!editable { padding-right: 15px; } QComboBox::drop-down:editable { border-image: url(:/images/button.png) 16; border-width: 10px; subcontrol-origin: margin; subcontrol-position: center right; width: 7px; height: 6px; } QComboBox::drop-down:editable:open { border-image: url(:/images/button-pressed.png) 16; } QComboBox:editable { margin-right: 29px; }