mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2024-11-15 12:15:43 +08:00
Ensure backward compatibility and some cosmetic changes.
This commit is contained in:
parent
7a3858a214
commit
8eb993a7f8
11
README.md
11
README.md
@ -39,11 +39,12 @@ The SingleApplication class implements a `showUp()` signal. You can bind to that
|
||||
Note that since `SingleApplication` extends the `QApplication` class you can do the following:
|
||||
```cpp
|
||||
// Truly raise your window.
|
||||
QObject::connect(&app, &SingleApplication::showUp, [&]{
|
||||
window.show();
|
||||
window.raise();
|
||||
window.activateWindow();
|
||||
}); // 'window' is your QWindow instance
|
||||
QObject::connect(&app, &SingleApplication::showUp, [&]
|
||||
{
|
||||
window.show();
|
||||
window.raise();
|
||||
window.activateWindow();
|
||||
}); // 'window' is your QWindow instance
|
||||
```
|
||||
|
||||
Using `QApplication::instance()` is a neat way to get the `SingleApplication` instance at any place in your program.
|
||||
|
@ -115,7 +115,7 @@ SingleApplication::SingleApplication(int &argc, char *argv[])
|
||||
// terminated.
|
||||
if( d->socket->waitForConnected(100) )
|
||||
{
|
||||
// Terminate the program using STDLib's exit function.
|
||||
// Terminate the program using STDLib's exit function
|
||||
::exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
delete d->memory;
|
||||
|
@ -2,6 +2,10 @@
|
||||
#define SINGLE_APPLICATION_H
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
#ifndef QAPPLICATION_CLASS
|
||||
#define QAPPLICATION_CLASS QApplication
|
||||
#endif
|
||||
|
||||
#include QT_STRINGIFY(QAPPLICATION_CLASS)
|
||||
|
||||
class SingleApplicationPrivate;
|
||||
|
Loading…
Reference in New Issue
Block a user