Gui: Support for default and flat buttons in QSS

This commit is contained in:
Kacper Donat
2025-09-17 16:15:39 +02:00
committed by Chris Hennes
parent 40bc9962d3
commit 3799a5b77d
3 changed files with 30 additions and 8 deletions

View File

@@ -115,7 +115,9 @@ Main window
==================================================================================================*/
QMainWindow,
QDockWidget {
background-color: @PrimaryColor;/* main background color */}
background-color: @PrimaryColor;/* main background color */
}
QDialog {
background-color: @DialogBackgroundColor;
}
@@ -1174,13 +1176,23 @@ https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qpushbutton
--------------------------------------------------------------------------- */
QPushButton {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor,stop:1 @ButtonBottomBackgroundColor);
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonTopBackgroundColor, stop:1 @ButtonBottomBackgroundColor);
border: 1px solid @ButtonBorderColor;
border-radius: @InputFieldBorderRadius;
padding: 3px 12px;
min-width: 64px;
}
QPushButton:default {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @DefaultButtonTopBackgroundColor, stop:1 @DefaultButtonBottomBackgroundColor);
border: 1px solid @DefaultButtonBorderColor;
}
QAbstractButton[flat="true"] {
background-color: transparent;
border: 1px solid transparent;
}
#CreateNewRow > QPushButton {
border-radius: @InputFieldBorderRadius;
}
@@ -1199,12 +1211,12 @@ QPushButton:checked {
background-color: qlineargradient(x1:0, y1:1, x2:0, y2:0, stop:0 @ButtonTopBackgroundColor, stop:0.6 @ButtonBottomBackgroundColor);
}
QPushButton:focus {
border: 1px solid @AccentColor;
QPushButton:focus, QAbstractButton[flat="true"]:focus {
border: 1px solid @AccentColor;
}
QPushButton:checked:disabled {
border: 1px solid @AccentColor;
border: 1px solid @AccentColor;
color: @TextDisabledColor;
outline: none;
}
@@ -1218,11 +1230,15 @@ QPushButton:hover {
background-color: @GeneralBackgroundHoverColor;
}
QPushButton:pressed {
QAbstractButton[flat="true"]:hover {
border: 1px solid @ButtonBorderColor;
}
QPushButton:pressed, QAbstractButton[flat="true"]:pressed {
border: 1px solid @GeneralBorderHoverColor;
}
QPushButton:selected {
QPushButton:selected, QAbstractButton[flat="true"]:selected {
border: 1px solid @GeneralBorderHoverColor;
}

View File

@@ -4,6 +4,9 @@ ButtonBorderColor: "@GeneralBorderColor"
ButtonBorderHooverColor: "@GeneralBorderColor"
ButtonBottomBackgroundColor: "@PrimaryColorLighten2"
ButtonTopBackgroundColor: "@PrimaryColorLighten3"
DefaultButtonBottomBackgroundColor: "blend(@ButtonBottomBackgroundColor, @AccentColor, 10)"
DefaultButtonTopBackgroundColor: "blend(@ButtonTopBackgroundColor, @AccentColor, 10)"
DefaultButtonBorderColor: "blend(@ButtonBorderColor, @AccentColor, 20)"
CheckBoxBackgroundColor: "@TextEditFieldBackgroundColor"
CheckBoxBorderColor: "@GeneralBorderColor"
DialogBackgroundColor: "@PrimaryColorLighten3"

View File

@@ -4,9 +4,12 @@ ButtonBorderColor: "@GeneralBorderColor"
ButtonBorderHooverColor: "@GeneralBorderColor"
ButtonBottomBackgroundColor: "@PrimaryColorDarken1"
ButtonTopBackgroundColor: "@PrimaryColorLighten3"
DefaultButtonBottomBackgroundColor: "blend(@ButtonBottomBackgroundColor, @AccentColor, 5)"
DefaultButtonTopBackgroundColor: "blend(@ButtonTopBackgroundColor, @AccentColor, 5)"
DefaultButtonBorderColor: "blend(@ButtonBorderColor, @AccentColor, 40)"
CheckBoxBackgroundColor: "@TextEditFieldBackgroundColor"
CheckBoxBorderColor: "@GeneralBorderColor"
DialogBackgroundColor: "@PrimaryColorLighten4"
DialogBackgroundColor: "@PrimaryColorLighten3"
GeneralAlternateBackgroundColor: "@PrimaryColor"
GeneralBackgroundColor: "@PrimaryColor"
GeneralBackgroundHoverColor: "@PrimaryColorLighten5"