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:
|
Note that since `SingleApplication` extends the `QApplication` class you can do the following:
|
||||||
```cpp
|
```cpp
|
||||||
// Truly raise your window.
|
// Truly raise your window.
|
||||||
QObject::connect(&app, &SingleApplication::showUp, [&]{
|
QObject::connect(&app, &SingleApplication::showUp, [&]
|
||||||
window.show();
|
{
|
||||||
window.raise();
|
window.show();
|
||||||
window.activateWindow();
|
window.raise();
|
||||||
}); // 'window' is your QWindow instance
|
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.
|
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.
|
// terminated.
|
||||||
if( d->socket->waitForConnected(100) )
|
if( d->socket->waitForConnected(100) )
|
||||||
{
|
{
|
||||||
// Terminate the program using STDLib's exit function.
|
// Terminate the program using STDLib's exit function
|
||||||
::exit(EXIT_SUCCESS);
|
::exit(EXIT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
delete d->memory;
|
delete d->memory;
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
#define SINGLE_APPLICATION_H
|
#define SINGLE_APPLICATION_H
|
||||||
#include <QtCore/QtGlobal>
|
#include <QtCore/QtGlobal>
|
||||||
|
|
||||||
|
#ifndef QAPPLICATION_CLASS
|
||||||
|
#define QAPPLICATION_CLASS QApplication
|
||||||
|
#endif
|
||||||
|
|
||||||
#include QT_STRINGIFY(QAPPLICATION_CLASS)
|
#include QT_STRINGIFY(QAPPLICATION_CLASS)
|
||||||
|
|
||||||
class SingleApplicationPrivate;
|
class SingleApplicationPrivate;
|
||||||
|
Loading…
Reference in New Issue
Block a user