refactor: minimize styling as much as possible
This commit is contained in:
@@ -13,60 +13,6 @@
|
||||
namespace QSint
|
||||
{
|
||||
|
||||
|
||||
const char* ActionBoxStyle =
|
||||
"QSint--ActionBox {"
|
||||
"background-color: white;"
|
||||
"border: 1px solid white;"
|
||||
"border-radius: 3px;"
|
||||
"text-align: left;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionBox:hover {"
|
||||
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F9FDFF, stop: 1 #EAF7FF);"
|
||||
"border: 1px solid #DAF2FC;"
|
||||
"}"
|
||||
|
||||
|
||||
"QSint--ActionBox QSint--ActionLabel[class='header'] {"
|
||||
"text-align: left;"
|
||||
"font: 14px;"
|
||||
"color: #006600;"
|
||||
"background-color: transparent;"
|
||||
"border: none;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionBox QSint--ActionLabel[class='header']:hover {"
|
||||
"color: #00cc00;"
|
||||
"text-decoration: underline;"
|
||||
"}"
|
||||
|
||||
|
||||
"QSint--ActionBox QSint--ActionLabel[class='action'] {"
|
||||
"background-color: transparent;"
|
||||
"border: none;"
|
||||
"color: #0033ff;"
|
||||
"text-align: left;"
|
||||
"font: 11px;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionBox QSint--ActionLabel[class='action']:!enabled {"
|
||||
"color: #999999;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionBox QSint--ActionLabel[class='action']:hover {"
|
||||
"color: #0099ff;"
|
||||
"text-decoration: underline;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionBox QSint--ActionLabel[class='action']:on {"
|
||||
"background-color: #ddeeff;"
|
||||
"color: #006600;"
|
||||
"}"
|
||||
|
||||
;
|
||||
|
||||
|
||||
ActionBox::ActionBox(QWidget *parent) :
|
||||
QFrame(parent)
|
||||
{
|
||||
@@ -92,8 +38,6 @@ void ActionBox::init()
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum);
|
||||
|
||||
setStyleSheet(QString(ActionBoxStyle));
|
||||
|
||||
QHBoxLayout *mainLayout = new QHBoxLayout(this);
|
||||
|
||||
QVBoxLayout *iconLayout = new QVBoxLayout();
|
||||
|
||||
@@ -15,35 +15,6 @@ namespace QSint
|
||||
{
|
||||
|
||||
|
||||
const char* ActionLabelStyle =
|
||||
"QSint--ActionLabel[class='action'] {"
|
||||
"background-color: transparent;"
|
||||
"border: 1px solid transparent;"
|
||||
"color: #0033ff;"
|
||||
"text-align: left;"
|
||||
"font: 11px;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionLabel[class='action']:!enabled {"
|
||||
"color: #999999;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionLabel[class='action']:hover {"
|
||||
"color: #0099ff;"
|
||||
"text-decoration: underline;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionLabel[class='action']:focus {"
|
||||
"border: 1px dotted black;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionLabel[class='action']:on {"
|
||||
"background-color: #ddeeff;"
|
||||
"color: #006600;"
|
||||
"}"
|
||||
;
|
||||
|
||||
|
||||
ActionLabel::ActionLabel(QWidget *parent) :
|
||||
QToolButton(parent)
|
||||
{
|
||||
@@ -66,8 +37,6 @@ void ActionLabel::init()
|
||||
|
||||
setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
|
||||
setStyleSheet(QString(ActionLabelStyle));
|
||||
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
@@ -13,17 +13,18 @@ namespace QSint
|
||||
|
||||
|
||||
const QString ActionPanelScheme::minimumStyle = QString::fromLatin1(
|
||||
"QSint--ActionGroup QFrame[class='header'] {"
|
||||
"border: none;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='header'] {"
|
||||
"text-align: left;"
|
||||
"background-color: transparent;"
|
||||
"border: 1px solid transparent;"
|
||||
"border: none;"
|
||||
"font-weight: bold;"
|
||||
"text-align: center;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='action'] {"
|
||||
"background-color: transparent;"
|
||||
"border: 1px solid transparent;"
|
||||
"text-align: left;"
|
||||
"border: none;"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='action']:hover {"
|
||||
@@ -31,71 +32,28 @@ const QString ActionPanelScheme::minimumStyle = QString::fromLatin1(
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QFrame[class='content'][header='true'] {"
|
||||
"border-top: none;"
|
||||
"border: none;"
|
||||
"}"
|
||||
|
||||
);
|
||||
|
||||
QString ActionPanelScheme::systemStyle(const QPalette& p)
|
||||
{
|
||||
QString headerBackground = p.color(QPalette::Highlight).name();
|
||||
QString headerLabelText = p.color(QPalette::HighlightedText).name();
|
||||
QString headerLabelTextOver = p.color(QPalette::BrightText).name();
|
||||
QString groupBorder = p.color(QPalette::Mid).name();
|
||||
QString disabledActionText = p.color(QPalette::Disabled, QPalette::Text).name();
|
||||
QString actionSelectedBg = p.color(QPalette::Active, QPalette::Light).name();
|
||||
QString actionSelectedText = p.color(QPalette::Active, QPalette::ButtonText).name();
|
||||
QString actionSelectedBorder = p.color(QPalette::Active, QPalette::Highlight).name();
|
||||
QString panelBackground = p.color(QPalette::Window).name();
|
||||
QString groupBackground = p.color(QPalette::Button).name();
|
||||
const QColor& highlightColor = p.color(QPalette::Highlight);
|
||||
QColor headerBackground = highlightColor.darker(150);
|
||||
const QColor& groupBackground = p.color(QPalette::Button);
|
||||
|
||||
QHash<QString, QString> replacements;
|
||||
replacements["headerBackground"] = headerBackground;
|
||||
replacements["headerLabelText"] = headerLabelText;
|
||||
replacements["headerLabelTextOver"] = headerLabelTextOver;
|
||||
replacements["groupBorder"] = groupBorder;
|
||||
replacements["disabledActionText"] = disabledActionText;
|
||||
replacements["actionSelectedBg"] = actionSelectedBg;
|
||||
replacements["actionSelectedText"] = actionSelectedText;
|
||||
replacements["actionSelectedBorder"] = actionSelectedBorder;
|
||||
replacements["panelBackground"] = panelBackground;
|
||||
replacements["groupBackground"] = groupBackground;
|
||||
replacements["headerBackground"] = headerBackground.name();
|
||||
replacements["groupBackground"] = groupBackground.name();;
|
||||
|
||||
QString style = QString::fromLatin1(
|
||||
"QFrame[class='panel'] {"
|
||||
"background-color: {panelBackground};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QFrame[class='header'] {"
|
||||
"border: 1px solid {headerBackground};"
|
||||
"background-color: {headerBackground};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='header'] {"
|
||||
"color: {headerLabelText};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='header']:hover {"
|
||||
"color: {headerLabelTextOver};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QFrame[class='content'] {"
|
||||
"border: 1px solid {groupBorder};"
|
||||
"background-color: {groupBackground};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='action']:!enabled {"
|
||||
"color: {disabledActionText};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='action']:focus {"
|
||||
"color: {actionSelectedText};"
|
||||
"border: 1px dotted {actionSelectedBorder};"
|
||||
"}"
|
||||
|
||||
"QSint--ActionGroup QToolButton[class='action']:on {"
|
||||
"background-color: {actionSelectedBg};"
|
||||
"color: {actionSelectedText};"
|
||||
"}"
|
||||
);
|
||||
|
||||
for (auto it = replacements.begin(); it != replacements.end(); ++it) {
|
||||
|
||||
Reference in New Issue
Block a user