From 56929664301607bd3fce8ee57ff51393ae33e3eb Mon Sep 17 00:00:00 2001 From: JackLee_CN <809262979@qq.com> Date: Tue, 5 Nov 2024 13:41:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dqss=20=E4=BF=AE=E5=A4=8DUID?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=B2=A1=E6=9C=89=E6=A3=80=E6=B5=8B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- res/qss/dark_style.qss | 17 ++++++++++++----- res/qss/light_style.qss | 6 ++++++ src/sui_sys_style.cpp | 16 ++++++++++------ src/sui_sys_style.h | 3 ++- src/xsteam_ui.cpp | 4 ++++ 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/res/qss/dark_style.qss b/res/qss/dark_style.qss index cbaa374..e5eb7df 100644 --- a/res/qss/dark_style.qss +++ b/res/qss/dark_style.qss @@ -8,10 +8,22 @@ QPushButton#ico_button{ image:url(:/res/img/xsteam.png); border:none; } + QLabel{ color:#F2F2F2; } +QPushButton{ + height:25px; +} +QComboBox{ + height:25px; +} +QPushButton:hover{ +padding-left:1px; +padding-top:1px; +} + QPushButton#BTN_DOWNLOAD{ width:25px; height:25px; @@ -33,11 +45,6 @@ QPushButton#BTN_ABOUT{ image:url(":/res/img/btn/btn_about.png"); } -QPushButton:hover{ -padding-left:1px; -padding-top:1px; -} - QGroupBox { color: #F2F2F2; } diff --git a/res/qss/light_style.qss b/res/qss/light_style.qss index b3892fe..a3cf257 100644 --- a/res/qss/light_style.qss +++ b/res/qss/light_style.qss @@ -13,6 +13,12 @@ QLabel{ color:#404040; } +QPushButton{ + height:25px; +} +QComboBox{ + height:25px; +} QPushButton:hover{ padding-left:1px; padding-top:1px; diff --git a/src/sui_sys_style.cpp b/src/sui_sys_style.cpp index 899d6e1..08c425c 100644 --- a/src/sui_sys_style.cpp +++ b/src/sui_sys_style.cpp @@ -8,20 +8,24 @@ sui_sys_style::~sui_sys_style() } void sui_sys_style::slots_sys_style_thread() { - //获取系统注册表信息 - QSettings style_set(QSettings::UserScope, "Microsoft", "Windows\\CurrentVersion\\Themes\\Personalize"); //当前系统主题状态,默认0-深色主题,1-浅色主题 - bool isDark=style_set.value("AppsUseLightTheme").toBool(); + Qt::ColorScheme cDark=QGuiApplication::styleHints()->colorScheme(); while (true) { //跟随功能是否开启,0-关闭,1-开启 采用bool类型 if (state==1) { //判断当前临时isDark状态是否和系统主题一致&不一致则更新当前软件主题 - if (isDark != style_set.value("AppsUseLightTheme").toBool()) + if (cDark != QGuiApplication::styleHints()->colorScheme()) { - emit signals_sys_style_change(style_set.value("AppsUseLightTheme").toInt()); - isDark = style_set.value("AppsUseLightTheme").toBool(); + int style; + if(QGuiApplication::styleHints()->colorScheme()==Qt::ColorScheme::Light){ + style=1; + }else if(QGuiApplication::styleHints()->colorScheme()==Qt::ColorScheme::Dark){ + style=0; + } + emit signals_sys_style_change(style); + cDark = QGuiApplication::styleHints()->colorScheme(); } } //刷新间隔5秒 diff --git a/src/sui_sys_style.h b/src/sui_sys_style.h index b4738a3..cf7cae4 100644 --- a/src/sui_sys_style.h +++ b/src/sui_sys_style.h @@ -4,7 +4,8 @@ #include #include #include - +#include +#include class sui_sys_style:public QObject { Q_OBJECT diff --git a/src/xsteam_ui.cpp b/src/xsteam_ui.cpp index cabc1a1..fff6ce8 100644 --- a/src/xsteam_ui.cpp +++ b/src/xsteam_ui.cpp @@ -255,6 +255,10 @@ void xsteam_ui::slots_get_uid_dlcs() UidData uid_data; uid_data.uid = ip_uid_edit->text().toStdString(); uid_data.s_name = server_txt->currentText().toStdString(); + if(uid_data.uid!=""){ + slots_msg_text("UID不能为空"); + return; + } slots_msg_text("获取DLC信息..."); ip_all_dlc_table->item_clear(); ip_in_dlc_table->item_clear();