mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Workaround palette not set on new windows
This commit is contained in:
parent
838b091acd
commit
8485e7ae81
3 changed files with 30 additions and 0 deletions
|
@ -376,6 +376,20 @@ MainWindow::showChatPage()
|
||||||
emit switchToChatPage();
|
emit switchToChatPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
NhekoFixupPaletteEventFilter::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
// Workaround for the QGuiApplication palette not being applied to toplevel windows for some
|
||||||
|
// reason?!?
|
||||||
|
if (event->type() == QEvent::ChildAdded &&
|
||||||
|
obj->metaObject()->className() == QStringLiteral("QQuickRootItem")) {
|
||||||
|
for (const auto window : QGuiApplication::topLevelWindows()) {
|
||||||
|
QGuiApplication::postEvent(window, new QEvent(QEvent::ApplicationPaletteChange));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::closeEvent(QCloseEvent *event)
|
MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,19 @@ class MemberList;
|
||||||
class ReCaptcha;
|
class ReCaptcha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NhekoFixupPaletteEventFilter final : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
NhekoFixupPaletteEventFilter(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
};
|
||||||
|
|
||||||
class MainWindow final : public QQuickView
|
class MainWindow final : public QQuickView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -309,6 +309,9 @@ main(int argc, char *argv[])
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto filter = new NhekoFixupPaletteEventFilter(&app);
|
||||||
|
app.installEventFilter(filter);
|
||||||
|
|
||||||
if (parser.isSet(configName))
|
if (parser.isSet(configName))
|
||||||
UserSettings::initialize(parser.value(configName));
|
UserSettings::initialize(parser.value(configName));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue