Qtabwidget Tabposition bei Verwendung von Stylesheets
-
27-10-2019 - |
Frage
Ich verwende derzeit Stylesheets, um eine Anwendung zu thematisieren. Hier ist das Stylesheet, das ich für QTabwidget verwende:
/*QTabBar et QTabWidget*/
QTabBar::tab {
background: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(73, 73, 74, 255), stop:1 rgba(40, 40, 40, 255));
border: 1px solid rgb(190, 190, 190);
max-height: 0.6em;
min-width: 0.6em;
padding: 5px;
margin-left: -1px;
margin-right: -1px;
}
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(39, 117, 219, 255), stop:1 rgba(107, 171, 249, 255));
}
QTabBar::tab:last {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
margin-right: 0px;
}
QTabBar::tab:first {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
margin-left: 0px;
}
QTabBar::tab:only-one {
border-radius: 3px;
margin: 0px;
}
Wenn die Tabposition auf Norden oder Süden eingestellt ist, kein Problem. Aber mit Ost oder West ist die Grenze der Tabbar nicht richtig gestaltet.
Weiß jemand, wie man eine Tabbar mit Tabposition nach Ost/West stymt?
Lösung
Von dem QT Stylesheet Referenzseite:
Die: oben,: links,: rechts,: untere Pseudozustände je nach Ausrichtung der Registerkarten.
Zum Beispiel, um Ihre erste CSS -Regel auf die Horizontale anzuwenden QTabBar
s:
QTabBar::tab:top, QTabBar::tab:bottom {
background: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(73, 73, 74, 255), stop:1 rgba(40, 40, 40, 255));
border: 1px solid rgb(190, 190, 190);
max-height: 0.6em;
min-width: 0.6em;
padding: 5px;
margin-left: -1px;
margin-right: -1px;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow