summary refs log tree commit diff
path: root/src/TextInputWidget.cc
diff options
context:
space:
mode:
authorMax Sandholm <max@sandholm.org>2017-11-16 16:33:52 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-11-16 16:33:52 +0200
commit19b526d4533841ca91209929f0d6aef6042a8eeb (patch)
tree596400e11b6275a961b9d57b02b0c0b502df38c4 /src/TextInputWidget.cc
parentDon't send empty messages (diff)
downloadnheko-19b526d4533841ca91209929f0d6aef6042a8eeb.tar.xz
Use system color scheme (using a Qt stylesheet) #104
The color scheme of nheko obeys the default color theme of Qt
(i.e. the system theme). It uses a Qt stylesheet to accomplish this,
which means replacing the color theme with a custom theme would only
be a matter of writing a new style sheet and loading it into the app.
Diffstat (limited to 'src/TextInputWidget.cc')
-rw-r--r--src/TextInputWidget.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc

index d71769f4..829784fd 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc
@@ -133,8 +133,8 @@ FilteredTextEdit::minimumSizeHint() const void FilteredTextEdit::submit() { - if (toPlainText().trimmed().isEmpty()) - return; + if (toPlainText().trimmed().isEmpty()) + return; if (true_history_.size() == INPUT_HISTORY_SIZE) true_history_.pop_back(); @@ -176,7 +176,6 @@ TextInputWidget::TextInputWidget(QWidget *parent) setFixedHeight(conf::textInput::height); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setCursor(Qt::ArrowCursor); - setStyleSheet("background-color: #fff;"); topLayout_ = new QHBoxLayout(); topLayout_->setSpacing(0); @@ -192,6 +191,7 @@ TextInputWidget::TextInputWidget(QWidget *parent) spinner_ = new LoadingIndicator(this); spinner_->setFixedHeight(32); spinner_->setFixedWidth(32); + spinner_->setObjectName("FileUploadSpinner"); spinner_->hide(); QFont font; @@ -202,7 +202,7 @@ TextInputWidget::TextInputWidget(QWidget *parent) input_->setFont(font); input_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); input_->setPlaceholderText(tr("Write a message...")); - input_->setStyleSheet("color: #333333; border: none; padding-top: 5px; margin: 0 5px"); + input_->setStyleSheet("border: none; padding-top: 5px;"); sendMessageBtn_ = new FlatButton(this); @@ -335,3 +335,12 @@ TextInputWidget::focusInEvent(QFocusEvent *event) { input_->setFocus(event->reason()); } + +void +TextInputWidget::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +}