mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2024-11-15 12:15:43 +08:00
d33b4c1c61
QApplication uses a reference of argc so it could modify it's value when it substitutes known arguments for example. Thanks to @Chocobozzz for reporting the issue. https://github.com/itay-grudev/SingleApplication/issues/1
32 lines
559 B
C++
32 lines
559 B
C++
#ifndef SINGLE_APPLICATION_H
|
|
#define SINGLE_APPLICATION_H
|
|
|
|
#include <QApplication>
|
|
#include <QLocalSocket>
|
|
#include <QLocalServer>
|
|
|
|
/**
|
|
* @brief The SingleApplication class handles multipe instances of the same Application
|
|
* @see QApplication
|
|
*/
|
|
class SingleApplication : public QApplication
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit SingleApplication(int&, char *[]);
|
|
~SingleApplication();
|
|
|
|
signals:
|
|
void showUp();
|
|
|
|
private slots:
|
|
void slotConnectionEstablished();
|
|
|
|
private:
|
|
QLocalSocket *socket;
|
|
QLocalServer *server;
|
|
|
|
};
|
|
|
|
#endif // SINGLE_APPLICATION_H
|