From 6e6fe0cad2f5f927db26febd4b5c8e07e1106c7e Mon Sep 17 00:00:00 2001 From: Adasauce Date: Fri, 21 Feb 2020 15:16:53 -0400 Subject: [PATCH] remove setStyleSheet calls directly from widget code removed from: - emoji panel scrollbars - emoji category labels - splitter image handles - textfield setTextColor impl small change to the category separator label for better contrast / readability in dark mode. removed setTextColor completely from TextField. Doesn't appear to be in use anywhere, and focus going more toward qss themeing from qproperty setting. --- resources/styles/nheko-dark.qss | 11 ++++++++++- resources/styles/nheko.qss | 8 ++++++++ resources/styles/system.qss | 10 ++++++++++ src/Splitter.cpp | 1 - src/emoji/Category.cpp | 1 - src/emoji/Panel.cpp | 4 ---- src/ui/TextField.cpp | 17 ----------------- src/ui/TextField.h | 4 ---- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/resources/styles/nheko-dark.qss b/resources/styles/nheko-dark.qss index 8597eccb..33e8e150 100644 --- a/resources/styles/nheko-dark.qss +++ b/resources/styles/nheko-dark.qss @@ -52,11 +52,18 @@ dialogs--JoinRoom > QLineEdit { color: #caccd1; } +emoji--Panel QWidget { border: none; } +emoji--Panel QScrollBar:vertical { width: 0px; margin: 0px; } +emoji--Panel QScrollBar::handle:vertical { min-height: 30px; } + emoji--Category, emoji--Category > * { background-color: #2d3139; - color: #caccd1; + color: #727274; +} +emoji--Category QLabel { + margin: 20px 0 20px 8px; } TimelineItem { @@ -237,3 +244,5 @@ SnackBar { qproperty-textColor: #caccd1; qproperty-bgColor: #202228; } + +QSplitter::handle { image: none; } diff --git a/resources/styles/nheko.qss b/resources/styles/nheko.qss index ffaba4e1..eeb90323 100644 --- a/resources/styles/nheko.qss +++ b/resources/styles/nheko.qss @@ -187,6 +187,10 @@ emoji--Panel > * { color: #333; } +emoji--Panel QWidget { border: none; } +emoji--Panel QScrollBar:vertical { width: 0px; margin: 0px; } +emoji--Panel QScrollBar::handle:vertical { min-height: 30px; } + emoji--Category { qproperty-hoverBackgroundColor: rgba(200, 200, 200, 70); } @@ -197,6 +201,8 @@ emoji--Category > * { color: #ccc; } +emoji--Category QLabel { margin: 20px 0 20px 8px; } + FloatingButton { qproperty-backgroundColor: #efefef; qproperty-foregroundColor: black; @@ -239,3 +245,5 @@ SnackBar { qproperty-textColor: white; qproperty-bgColor: #495057; } + +QSplitter::handle { image: none; } diff --git a/resources/styles/system.qss b/resources/styles/system.qss index 2d4b2d8c..db8f4b4e 100644 --- a/resources/styles/system.qss +++ b/resources/styles/system.qss @@ -138,6 +138,10 @@ emoji--Panel > * { color: palette(text); } +emoji--Panel QWidget { border: none; } +emoji--Panel QScrollBar:vertical { width: 0px; margin: 0px; } +emoji--Panel QScrollBar::handle:vertical { min-height: 30px; } + emoji--Category { qproperty-hoverBackgroundColor: palette(highlight); } @@ -148,6 +152,10 @@ emoji--Category > * { color: palette(text); } +emoji--Category QLabel { + margin: 20px 0 20px 8px; +} + FloatingButton { qproperty-backgroundColor: palette(base); qproperty-foregroundColor: palette(text); @@ -164,3 +172,5 @@ Toggle { qproperty-inactiveColor: palette(mid); qproperty-trackColor: palette(base); } + +QSplitter::handle { image: none; } diff --git a/src/Splitter.cpp b/src/Splitter.cpp index 6267e591..a2f95ed4 100644 --- a/src/Splitter.cpp +++ b/src/Splitter.cpp @@ -28,7 +28,6 @@ Splitter::Splitter(QWidget *parent) { connect(this, &QSplitter::splitterMoved, this, &Splitter::onSplitterMoved); setChildrenCollapsible(false); - setStyleSheet("QSplitter::handle { image: none; }"); } void diff --git a/src/emoji/Category.cpp b/src/emoji/Category.cpp index 659555f7..e674e9db 100644 --- a/src/emoji/Category.cpp +++ b/src/emoji/Category.cpp @@ -75,7 +75,6 @@ Category::Category(QString category, std::vector emoji, QWidget *parent) category_ = new QLabel(category, this); category_->setFont(font); - category_->setStyleSheet("margin: 20px 0 20px 8px;"); mainLayout_->addWidget(category_); mainLayout_->addWidget(emojiListView_); diff --git a/src/emoji/Panel.cpp b/src/emoji/Panel.cpp index e3b966b4..f0e4449d 100644 --- a/src/emoji/Panel.cpp +++ b/src/emoji/Panel.cpp @@ -35,10 +35,6 @@ Panel::Panel(QWidget *parent) , height_{350} , categoryIconSize_{20} { - setStyleSheet("QWidget {border: none;}" - "QScrollBar:vertical { width: 0px; margin: 0px; }" - "QScrollBar::handle:vertical { min-height: 30px; }"); - setAttribute(Qt::WA_ShowWithoutActivating, true); setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint); diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index 6c1552a8..4bb7596a 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -102,23 +102,6 @@ TextField::label() const return label_text_; } -void -TextField::setTextColor(const QColor &color) -{ - text_color_ = color; - setStyleSheet(QString("QLineEdit { color: %1; }").arg(color.name())); -} - -QColor -TextField::textColor() const -{ - if (!text_color_.isValid()) { - return QPalette().color(QPalette::Text); - } - - return text_color_; -} - void TextField::setLabelColor(const QColor &color) { diff --git a/src/ui/TextField.h b/src/ui/TextField.h index 100fed31..85d5036d 100644 --- a/src/ui/TextField.h +++ b/src/ui/TextField.h @@ -15,7 +15,6 @@ class TextField : public QLineEdit { Q_OBJECT - Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor) Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor) Q_PROPERTY(QColor labelColor WRITE setLabelColor READ labelColor) Q_PROPERTY(QColor underlineColor WRITE setUnderlineColor READ underlineColor) @@ -30,12 +29,10 @@ public: void setLabelColor(const QColor &color); void setLabelFontSize(qreal size); void setShowLabel(bool value); - void setTextColor(const QColor &color); void setUnderlineColor(const QColor &color); QColor inkColor() const; QColor labelColor() const; - QColor textColor() const; QColor underlineColor() const; QColor backgroundColor() const; QString label() const; @@ -52,7 +49,6 @@ private: QColor ink_color_; QColor background_color_; QColor label_color_; - QColor text_color_; QColor underline_color_; QString label_text_; TextFieldLabel *label_;