fixed some light mode issues

This commit is contained in:
fourtf 2018-04-18 09:33:05 +02:00
parent 3446a623f5
commit 653e4c6adf
9 changed files with 31 additions and 19 deletions

View file

@ -112,6 +112,12 @@ void BaseWidget::childEvent(QChildEvent *event)
}
}
void BaseWidget::showEvent(QShowEvent *)
{
this->scaleChangedEvent(this->getScale());
this->themeRefreshEvent();
}
void BaseWidget::setScale(float value)
{
// update scale value

View file

@ -41,6 +41,8 @@ protected:
virtual void scaleChangedEvent(float newScale);
virtual void themeRefreshEvent();
virtual void showEvent(QShowEvent *) override;
void setScale(float value);
private:

View file

@ -74,7 +74,6 @@ SplitHeader::SplitHeader(Split *_split)
// ---- misc
this->layout()->setMargin(0);
this->themeRefreshEvent();
this->scaleChangedEvent(this->getScale());
this->updateChannelText();

View file

@ -31,7 +31,6 @@ SplitInput::SplitInput(Split *_chatWidget)
// misc
this->installKeyPressedEvent();
this->themeRefreshEvent();
this->scaleChangedEvent(this->getScale());
}
@ -112,8 +111,6 @@ void SplitInput::scaleChangedEvent(float scale)
// set maximum height
this->setMaximumHeight((int)(150 * this->getScale()));
this->themeRefreshEvent();
}
void SplitInput::themeRefreshEvent()

View file

@ -123,8 +123,6 @@ SelectChannelDialog::SelectChannelDialog()
this->setScaleIndependantSize(300, 210);
this->setStyleSheet("QRadioButton { color: #fff } QLabel { color: #fff }");
// Shortcuts
auto *shortcut_ok = new QShortcut(QKeySequence("Return"), this);
QObject::connect(shortcut_ok, &QShortcut::activated, [=] { this->ok(); });
@ -255,15 +253,21 @@ bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched, QEvent *eve
return false;
}
void SelectChannelDialog::SelectChannelDialog::showEvent(QShowEvent *)
{
// QTimer::singleShot(100, [=] { this->setSelectedChannel(this->selectedChannel); });
}
void SelectChannelDialog::closeEvent(QCloseEvent *)
{
this->closed.invoke();
}
void SelectChannelDialog::themeRefreshEvent()
{
BaseWindow::themeRefreshEvent();
if (this->themeManager.isLightTheme()) {
this->setStyleSheet("QRadioButton { color: #000 } QLabel { color: #000 }");
} else {
this->setStyleSheet("QRadioButton { color: #fff } QLabel { color: #fff }");
}
}
} // namespace widgets
} // namespace chatterino

View file

@ -25,7 +25,7 @@ public:
protected:
virtual void closeEvent(QCloseEvent *) override;
virtual void showEvent(QShowEvent *) override;
virtual void themeRefreshEvent() override;
private:
class EventFilter : public QObject

View file

@ -56,10 +56,6 @@ void SettingsDialog::initUi()
}
// ---- misc
QPalette palette;
palette.setColor(QPalette::Background, QColor("#444"));
this->setPalette(palette);
this->ui.tabContainerContainer->setObjectName("tabWidget");
this->ui.pageStack->setObjectName("pages");
@ -166,6 +162,15 @@ void SettingsDialog::scaleChangedEvent(float newDpi)
this->ui.tabContainerContainer->setFixedWidth((int)(200 * newDpi));
}
void SettingsDialog::themeRefreshEvent()
{
BaseWindow::themeRefreshEvent();
QPalette palette;
palette.setColor(QPalette::Background, QColor("#444"));
this->setPalette(palette);
}
// void SettingsDialog::setChildrensFont(QLayout *object, QFont &font, int indent)
//{
// // for (QWidget *widget : this->widgets) {

View file

@ -32,7 +32,8 @@ public:
static void showDialog(PreferredTab preferredTab = PreferredTab::NoPreference);
protected:
void scaleChangedEvent(float newDpi) override;
virtual void scaleChangedEvent(float newDpi) override;
virtual void themeRefreshEvent() override;
private:
void refresh();

View file

@ -61,8 +61,6 @@ Window::Window(singletons::ThemeManager &_themeManager, WindowType _type)
// set margin
layout->setMargin(0);
this->themeRefreshEvent();
/// Initialize program-wide hotkeys
// CTRL+P: Open Settings Dialog
CreateWindowShortcut(this, "CTRL+P", [] { SettingsDialog::showDialog(); });