Single Application
The QtSingleApplication component provides support for applications that can be only started once per user.
For some applications it is useful or even critical that they are started only once by any user. Future attempts to start the application should activate any already running instance, and possibly perform requested actions, e.g. loading a file, in that instance.
The QtSingleApplication class provides an interface to detect a running instance, and to send command strings to that instance.
On Windows the implementation uses FindWindow() to detect a running instance, and the WM_COPYDATA message to send string data.
On X11 systems the implementation uses X atoms to communicate through the selection mechanism.
On Mac OS X named ports are used both to detect a running instance and to send string data.
This Qt Solutions component is for Qt 3. For Qt 4 Solutions, please visit the Qt 4 Solutions Catalog.
Documentation:
Classes
ExamplesTested on:
- Qt 3.3.6 / Windows XP / MSVC.NET 2003
- Qt 3.3.6 / Linux / gcc
- Qt 3.3.6 / SunOS 5.9 / SunC++
- Qt 3.3.6 / MacOS X 10.4 / gcc
Unsupported platforms:
Only the tested platforms are supported, however the classes should be platform independent and are likely to work on the platforms supported by Qt.
Download Commercial Edition:
Only available for Qt Solutions license holder with a valid Support and Maintenance agreement (authentication required).> <br>
Changes:
- 1.4: Mac: fix memory leak.
- 1.4: Mac: fix crash due to wrong object releasing.
- 1.3: Build fixes.
- 1.3: Documentation fixes.
- 1.3: Fixed a race condition on Windows.
- : Added support for Max OS X
- : Added missing file: qtsingleapplication_mac.cpp
- : Fixed error in qtsingleapplication.pri preventing project from compiling under other X11 systems.
- : Make registration of instance an atomic operation on Windows.

