modify:change the trigger method of thread

This commit is contained in:
renpeijia 2021-11-19 19:56:46 +08:00
parent d85185b635
commit 1e845d537d
3 changed files with 1 additions and 33 deletions

View File

@ -29,8 +29,6 @@
#include "xatom-helper.h"
#endif
#include "threaddriver.h"
#define LOG_IDENT "ukui_kylin_nm"
void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
@ -99,13 +97,11 @@ int main(int argc, char *argv[])
QApplication::setQuitOnLastWindowClosed(false);
ThreadDriver networkManagerDiver;
QThread thread;
KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance();
p_networkResource->moveToThread(&thread);
QObject::connect(&networkManagerDiver, SIGNAL(initSignal()), p_networkResource, SLOT(onInitNetwork()));
QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork()));
thread.start();
networkManagerDiver.emitSignal();
// Internationalization
QString locale = QLocale::system().name();

View File

@ -66,6 +66,3 @@ unix {
DISTFILES += \
org.ukui.kylin-nm.switch.gschema.xml
HEADERS += \
threaddriver.h

View File

@ -1,25 +0,0 @@
#ifndef THREADDRIVER_H
#define THREADDRIVER_H
#include <QtCore/QCoreApplication>
#include <QtCore/QObject>
#include <QtCore/QThread>
#include <QtCore/QDebug>
class ThreadDriver:public QObject
{
Q_OBJECT
public:
ThreadDriver(QObject* parent=0):QObject(parent){}
public slots:
void emitSignal() {
emit initSignal();
}
signals:
void initSignal();
};
#endif // THREADDRIVER_H