| Header: | #include <QSingleInstanceCheck> |
| QSingleInstanceCheck(const int uniqueID, int *parent = nullptr) | |
| virtual | ~QSingleInstanceCheck() |
| void | error(int message) |
| bool | isAlreadyRunning() const |
| void | notified() |
| void | notify() |
The QSingleInstanceCheck class can be used to test if your app is already running, or if this instance is the first (or only) one running.
This library consists of a header only.
Under the hood, QSingleInstanceCheck uses shared memory to check if it's the first instance or not, and a local socket (domain socket or named pipe, depending on the platform) to notify the original instance that another one has been started.
QConstructs a SingleInstanceCheck
All instances must use the same uniqueID to differentiate themselves from other applications. Hard code this in your application. It is recommended not to use special characters for maximum compatibility.
Optionally, the parent is the owner of the object.
[virtual constexpr noexcept] QSingleInstanceCheck::~QSingleInstanceCheck()Default deconstructor.
The error signal is emitted when the local server or failed memory failed to initialize. The message provides details on what went wrong.
Returns true if another instance is running.
This signal is emitted in the main instance when a subsequent instance called its notify() method.
See also notify().
Sends a notification to the original instance. If this is the original instance, it's a no-op.
See also notified().