update
parent
51aef3f3ec
commit
aba33c4d1f
|
@ -12,6 +12,8 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
//将样式设置为Basic,不然会导致组件显示异常
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||
//6.4及以下监听系统深色模式变化
|
||||
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
||||
QCoreApplication::setOrganizationName("ZhuZiChu");
|
||||
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||
QCoreApplication::setApplicationName("FluentUI");
|
||||
|
|
|
@ -34,6 +34,7 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event)
|
|||
Q_UNUSED(obj);
|
||||
if (event->type() == QEvent::ApplicationPaletteChange)
|
||||
{
|
||||
qDebug()<<"--------->";
|
||||
Q_EMIT darkChanged();
|
||||
event->accept();
|
||||
return true;
|
||||
|
@ -43,7 +44,7 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event)
|
|||
|
||||
bool FluTheme::systemDark()
|
||||
{
|
||||
QPalette palette = (qobject_cast<QGuiApplication *>(QCoreApplication::instance()))->palette();
|
||||
QPalette palette = (qobject_cast<QGuiApplication *>(QGuiApplication::instance()))->palette();
|
||||
QColor color = palette.color(QPalette::Window).rgb();
|
||||
return !(color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 > 255 / 2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue