ich befasse mich gerade damit, ob es eine Möglichkeit gibt, styleSheet's individuell zusammenstellen.
Meine Überlegung ist, dass man ein einheitliches Layout für die eigene Projekte erreichen möchte.
Im folgendem Beispiel, erstelle ich einen jeweils eigenen styleSheet. Diese möchte ich je nach Anwendung kombinieren können (zusammenführen).
Code: Alles auswählen
TabBarStyleSheet = """
QTabBar{
background: orange;
}
QTabBar::tab{
height: 40px;
min-width: 200px;
font-size: 16px;
font-weight: bold;
border-radius: 5px;
}
QTabBar::tab:selected{
background: darkred;
color: yellow;
}
QTabBar::tab:!selected{
background: darkgrey;
color: orange;
}
ScrollBarStyleSheet = """
QScrollBar::handle {
background: orange;
border-radius: 9px;
}
QScrollBar::handle::pressed {
background : orange;
}
QScrollBar:horizontal {
background-color: grey;
height: 18px;
}
QScrollBar::left-arrow:horizontal {
background: red;
height: 40px;
width: 40px
}
QScrollBar::right-arrow:horizontal {
background: red;
height: 40px;
}
QScrollBar:vertical {
background-color: grey;
width: 18px;
}
QScrollBar::up-arrow:vertical {
background: red;
height: 40px;
width: 40px
}
QScrollBar::down-arrow:vertical {
background: red;
height: 40px;
width: 40px
}
"""
Ich habe dazu, folgendes versucht, was aber nicht funktioniert, obwohl es in der visuellen Ausgabe passen müsste.
Code: Alles auswählen
tabbarStyle = [(x + '}') for x in TabBarStyleSheet.split('}')][:-1]
scrollbarStyle = [(x + '}') for x in ScrollBarStyleSheet.split('}')][:-1]
for x in tabbarStyle:
scrollbarStyle.append(x)
print(scrollbarStyle)
ScrollBarStyle = '"""{}"""'.format(''.join([x for x in scrollbarStyle]))
print(ScrollBarStyle)
Grüße Nobuddy