QCtrlSignals
1.0.0
A library to catch and handle windows and unix signals, in a cross platform manner
|
A class to listen for "CTRL-Signals". More...
#include <qctrlsignalhandler.h>
Public Types | |
enum | CommonSignals { SigInt = SIGINT, SigTerm = SIGTERM } |
Common signals, that are available on all platforms. More... | |
Public Slots | |
void | setAutoQuitActive (bool autoQuitActive) |
WRITE-Accessor for QCtrlSignalHandler::autoQuitActive. | |
Signals | |
void | sigInt () |
Shortcut signal for QCtrlSignalHandler::SigInt. More... | |
void | sigTerm () |
Shortcut signal for QCtrlSignalHandler::SigTerm. More... | |
void | ctrlSignal (int signal) |
Will be emitted if a registered signal occures. More... | |
void | autoQuitActiveChanged (bool autoQuitActive) |
NOTIFY-Accessor for QCtrlSignalHandler::autoQuitActive. | |
Public Member Functions | |
bool | registerForSignal (int signal) |
Registers this handler for the given signal. | |
bool | unregisterFromSignal (int signal) |
Unregisters this handler from the given signal. | |
bool | isAutoQuitActive () const |
READ-Accessor for QCtrlSignalHandler::autoQuitActive. | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
virtual const QMetaObject * | metaObject () const |
QString | objectName () const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const |
bool | isWindowType () const |
bool | signalsBlocked () const |
bool | blockSignals (bool block) |
QThread * | thread () const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const |
const QObjectList & | children () const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const |
bool | disconnect (const QObject *receiver, const char *method) const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const |
QList< QByteArray > | dynamicPropertyNames () const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const |
bool | inherits (const char *className) const |
void | deleteLater () |
Static Public Member Functions | |
static QCtrlSignalHandler * | instance () |
Returns the singleton instance of the signal handler. | |
Static Public Member Functions inherited from QObject | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Properties | |
bool | autoQuitActive |
Specifies, whether the handler should automatically handle signals that "quit" the app. More... | |
Properties inherited from QObject | |
objectName | |
Friends | |
class | QCtrlSignalHandlerPrivate |
class | QCtrlSignalHandlerInstance |
Additional Inherited Members | |
Protected Member Functions inherited from QObject | |
QObject * | sender () const |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
A class to listen for "CTRL-Signals".
Those signals are the typical operating system signals, that can be send to applications. These are:
The QCtrlSignalHandler allows you to register for those signals in a cross-platform way. This means, some signals, that are present on all OSses, can be found in the QCtrlSignalHandler::CommonSignals enum. Others can be registered per platform.
The handler internally registers for those signals (Ctrl-Signals), and will emit the ctrlSignal() signal (Qt-Signal).
Definition at line 18 of file qctrlsignalhandler.h.
Common signals, that are available on all platforms.
SIGQUIT
on linux.Enumerator | |
---|---|
SigInt | Mapped to |
SigTerm | Mapped to |
Definition at line 29 of file qctrlsignalhandler.h.
|
signal |
Will be emitted if a registered signal occures.
signal | The CTRL-Signal that was triggered |
It is only emitted for manually registered signals, not for others. It is independent of the autoQuitActive property.
|
signal |
Shortcut signal for QCtrlSignalHandler::SigInt.
It is only emitted for manually registered signals, not for others. It is independent of the autoQuitActive property.
|
signal |
Shortcut signal for QCtrlSignalHandler::SigTerm.
It is only emitted for manually registered signals, not for others. It is independent of the autoQuitActive property.
|
readwrite |
Specifies, whether the handler should automatically handle signals that "quit" the app.
Default: false
If auto quit is active, the handler will automatically register for "quit-like" signals. If they occur, it will handle them and automatically shut down the application by using QCoreApplication::quit
.
Accessors | |
---|---|
READ | isAutoQuitActive() |
WRITE | setAutoQuitActive() |
NOTIFY | autoQuitActiveChanged() |
Definition at line 25 of file qctrlsignalhandler.h.