This commit is contained in:
zhuzihcu 2023-04-20 09:15:28 +08:00
parent 882606b2f6
commit d5744a39bd
4 changed files with 12 additions and 7 deletions

View File

@ -54,11 +54,12 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 height: 36+multiine_textbox.height
paddings: 10 paddings: 10
Layout.topMargin: 20 Layout.topMargin: 20
FluMultilineTextBox{ FluMultilineTextBox{
id:multiine_textbox
Layout.topMargin: 20 Layout.topMargin: 20
placeholderText: "多行输入框" placeholderText: "多行输入框"
Layout.preferredWidth: 300 Layout.preferredWidth: 300

View File

@ -58,7 +58,11 @@ FluScrollablePage{
Layout.topMargin: 5 Layout.topMargin: 5
selected: FluTheme.dark selected: FluTheme.dark
clickFunc:function(){ clickFunc:function(){
FluTheme.dark = !FluTheme.dark if(FluTheme.dark){
FluTheme.darkMode = FluDarkMode.Light
}else{
FluTheme.darkMode = FluDarkMode.Dark
}
} }
} }
FluText{ FluText{

View File

@ -14,9 +14,9 @@ int main(int argc, char *argv[])
qputenv("QT_QUICK_CONTROLS_STYLE","Basic"); qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
//6.4及以下监听系统深色模式变化 //6.4及以下监听系统深色模式变化
qputenv("QT_QPA_PLATFORM","windows:darkmode=2"); qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
QCoreApplication::setOrganizationName("ZhuZiChu"); QGuiApplication::setOrganizationName("ZhuZiChu");
QCoreApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QCoreApplication::setApplicationName("FluentUI"); QGuiApplication::setApplicationName("FluentUI");
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software); // QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false); app.setQuitOnLastWindowClosed(false);

View File

@ -26,7 +26,7 @@ FluTheme::FluTheme(QObject *parent)
nativeText(false); nativeText(false);
frameless(true); frameless(true);
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light); darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
(qobject_cast<QGuiApplication *>(QCoreApplication::instance()))->installEventFilter(this); qApp->installEventFilter(this);
} }
bool FluTheme::eventFilter(QObject *obj, QEvent *event) bool FluTheme::eventFilter(QObject *obj, QEvent *event)
@ -43,7 +43,7 @@ bool FluTheme::eventFilter(QObject *obj, QEvent *event)
bool FluTheme::systemDark() bool FluTheme::systemDark()
{ {
QPalette palette = (qobject_cast<QGuiApplication *>(QGuiApplication::instance()))->palette(); QPalette palette = qApp->palette();
QColor color = palette.color(QPalette::Window).rgb(); QColor color = palette.color(QPalette::Window).rgb();
return !(color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 > 255 / 2); return !(color.red() * 0.2126 + color.green() * 0.7152 + color.blue() * 0.0722 > 255 / 2);
} }