-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingleapplication.h
More file actions
38 lines (29 loc) · 960 Bytes
/
singleapplication.h
File metadata and controls
38 lines (29 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef SINGLEAPPLICATION_H
#define SINGLEAPPLICATION_H
//引用:https://blog.csdn.net/qq_40650582/article/details/108260946
#include <QObject>
#include <QWidget>
#include <QApplication>
#include <QtNetwork/QLocalServer>
class SingleApplication : public QApplication
{
Q_OBJECT
public:
SingleApplication(int &argc, char *argv[]);
bool isRunning(); // 是否已有实例在运行
QWidget *w; //MainWindow指针
private slots:
//有新连接时触发
void NewLocalConnection();
private:
//初始化本地连接
void InitLocalConnection();
//创建服务端
void NewLocalServer();
//激活窗口
void ActivateWindow();
QLocalServer *localserver; //是否已有实例在运行
QString serverName; //本地socket Server
bool isRunnings; //服务名称
};
#endif // SINGLEAPPLICATION_H