aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Pyatnichenko <partizanu3@gmail.com>2016-04-05 20:31:05 +0300
committerVlad Pyatnichenko <partizanu3@gmail.com>2016-04-05 20:31:05 +0300
commit8eb993a7f81428b816d47887cd60139d1dfa7fff (patch)
treee1775fc6811a045bff8a9741a428d875012ea08e
parentHOTFIX: use Q_Q instead of q_ptr directly. (diff)
downloadsingleapplication-8eb993a7f81428b816d47887cd60139d1dfa7fff.tar.xz
Ensure backward compatibility and some cosmetic changes.
-rw-r--r--README.md11
-rw-r--r--singleapplication.cpp2
-rw-r--r--singleapplication.h4
3 files changed, 11 insertions, 6 deletions
diff --git a/README.md b/README.md
index 754e6b4..f677ba6 100644
--- a/README.md
+++ b/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.
diff --git a/singleapplication.cpp b/singleapplication.cpp
index 1c0d921..27e2bb1 100644
--- a/singleapplication.cpp
+++ b/singleapplication.cpp
@@ -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;
diff --git a/singleapplication.h b/singleapplication.h
index dc6beb3..91f5b11 100644
--- a/singleapplication.h
+++ b/singleapplication.h
@@ -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;