Переглянути джерело

V0.8.5
1、修复了换肤来不及处理换肤信号的问题

Apple 3 місяців тому
батько
коміт
a756aea040

+ 5 - 0
TransmitterSwitch/TransmitterSwitchInfo.cpp

@@ -2,6 +2,7 @@
 
 // #include "lhstylemanager.h"
 #include <QFile>
+#include <QEventLoop>
 
 ExecPlanItemInfo::ExecPlanItemInfo()
 {
@@ -222,5 +223,9 @@ void ExecPlanGlobalConfig::setUIStyle(enum_UIStyle style)
     }
     /* 发送普通换肤信号信号 */
     emit signal_qssChanged();
+
+    /* 处理事件,让UI接收到换肤信号 */
+    QEventLoop loop;
+    loop.processEvents();
 }
 

+ 6 - 2
TransmitterSwitch/lhtranmitterswitch.cpp

@@ -4,6 +4,9 @@
 #include "transmitterswitch.h"
 #include "loginit.h"
 
+#include <thread>
+
+
 TransmitterSwitch* g_pTransmitterSwitch = nullptr;
 InitData g_initData;
 
@@ -22,9 +25,10 @@ int LHTRANSMITTERSWITCH_EXPORT DoCreateWindow(int skintype, QWidget* parent)
     if (g_pTransmitterSwitch == nullptr)
     {
         g_pTransmitterSwitch = new TransmitterSwitch(parent);
+
         if(skintype < 0 || skintype > 1)
         {
-            g_pTransmitterSwitch->setUIStyle(0);
+            g_pTransmitterSwitch->setUIStyle(1);
             return -2;
         }
         g_pTransmitterSwitch->setUIStyle(skintype);
@@ -42,7 +46,7 @@ int LHTRANSMITTERSWITCH_EXPORT DoShowWindow(int skintype, bool showWindow)
     }
     if(skintype < 0 || skintype > 1)
     {
-        g_pTransmitterSwitch->setUIStyle(0);
+        // g_pTransmitterSwitch->setUIStyle(0);
         return -2;
     }
     g_pTransmitterSwitch->setUIStyle(skintype);

+ 4 - 1
show1/widget.cpp

@@ -35,8 +35,11 @@ Widget::Widget(QWidget *parent) :
     initData.url = "http://192.1.3.133:31000/v6/";
     initData.serverID = "2e36b53ccd2a433b9a803b98d683ed91";
     initData.serverKey = "TMS";
+
     m_tSwitch->DoInit(&initData);
-    m_tSwitch->DoCreateWindow(0, ui->widget_content);
+    m_tSwitch->DoCreateWindow(1, ui->widget_content);
+
+    m_style = 1;
     // m_tSwitch->setWebAPIInfo("http://192.1.3.133:31000/v6/", "2e36b53ccd2a433b9a803b98d683ed91", "TMS");
 
     /* 添加设备信息,测试用 */