1 Star 1 Fork 1

Atom / Qt_hmi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
singleapplication.h 821 Bytes
一键复制 编辑 原始数据 按行查看 历史
Atom 提交于 2021-01-20 19:52 . Fist upload source code
#ifndef SINGLEAPPLICATION_H
#define SINGLEAPPLICATION_H
#include <QObject>
#include <QApplication>
#include <QtNetwork/QLocalSocket>
#include <QWidget>
#include <QThread>
class LocalSocketHandleThread : public QThread
{
Q_OBJECT
public:
LocalSocketHandleThread (QLocalSocket &sock);
~LocalSocketHandleThread();
void run();
private slots:
void onReadyRead();
void onError(QLocalSocket::LocalSocketError);
private:
int writeData(QByteArray &data);
QLocalSocket *_client;
};
class SingleApplication : public QApplication {
Q_OBJECT
public:
SingleApplication(int argc, char **argv);
bool isRunning();
QWidget *w;
private:
void _initLocalConnection();
void _activateWindow();
bool _isRunning;
QLocalSocket *_localSocket;
QByteArray _pipeName;
};
#endif // SINGLEAPPLICATION_H
C++
1
https://gitee.com/atom-zh/qt_hmi.git
git@gitee.com:atom-zh/qt_hmi.git
atom-zh
qt_hmi
Qt_hmi
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891