KApplication
#include <kapplication.h>

Signals | |
void | saveYourself () |
Public Slots | |
void | commitData (QSessionManager &sm) |
Q_SCRIPTABLE void | quit () |
Q_SCRIPTABLE void | reparseConfiguration () |
void | saveState (QSessionManager &sm) |
Q_SCRIPTABLE void | updateUserTimestamp (int time=0) |
Public Member Functions | |
KApplication (bool GUIenabled=true) | |
void | clearStartupId () |
void | disableSessionManagement () |
void | enableSessionManagement () |
void | installX11EventFilter (QWidget *filter) |
void | removeX11EventFilter (const QWidget *filter) |
KConfig * | sessionConfig () |
bool | sessionSaving () const |
void | setStartupId (const QByteArray &startup_id) |
void | setTopWidget (QWidget *topWidget) |
QByteArray | startupId () const |
void | updateRemoteUserTimestamp (const QString &service, int time=0) |
unsigned long | userTimestamp () const |
![]() | |
QApplication (int &argc, char **argv) | |
bool | autoSipEnabled () const const |
void | focusChanged (QWidget *old, QWidget *now) |
virtual bool | notify (QObject *receiver, QEvent *e) override |
qApp qApp | |
void | setAutoSipEnabled (const bool enabled) |
void | setStyleSheet (const QString &sheet) |
QString | styleSheet () const const |
![]() | |
QGuiApplication (int &argc, char **argv) | |
void | applicationDisplayNameChanged () |
void | applicationStateChanged (Qt::ApplicationState state) |
void | commitDataRequest (QSessionManager &manager) |
qreal | devicePixelRatio () const const |
void | focusObjectChanged (QObject *focusObject) |
void | focusWindowChanged (QWindow *focusWindow) |
void | fontChanged (const QFont &font) |
void | fontDatabaseChanged () |
bool | isSavingSession () const const |
bool | isSessionRestored () const const |
void | lastWindowClosed () |
void | layoutDirectionChanged (Qt::LayoutDirection direction) |
void | paletteChanged (const QPalette &palette) |
void | primaryScreenChanged (QScreen *screen) |
qGuiApp qGuiApp | |
void | saveStateRequest (QSessionManager &manager) |
void | screenAdded (QScreen *screen) |
void | screenRemoved (QScreen *screen) |
QString | sessionId () const const |
QString | sessionKey () const const |
![]() | |
QCoreApplication (int &argc, char **argv) | |
void | aboutToQuit () |
void | applicationNameChanged () |
void | applicationVersionChanged () |
void | installNativeEventFilter (QAbstractNativeEventFilter *filterObj) |
void | organizationDomainChanged () |
void | organizationNameChanged () |
Q_COREAPP_STARTUP_FUNCTION (ptr) | |
Q_DECLARE_TR_FUNCTIONS (context) | |
void | qAddPostRoutine (QtCleanUpFunction ptr) |
void | qRemovePostRoutine (QtCleanUpFunction ptr) |
void | removeNativeEventFilter (QAbstractNativeEventFilter *filterObject) |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
KApplication (bool GUIenabled, const KComponentData &cData) | |
![]() | |
virtual bool | event (QEvent *e) override |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Attributes | |
static KApplication * | KApp = nullptr |
Additional Inherited Members | |
![]() | |
enum | ColorSpec |
![]() | |
enum | Encoding |
![]() | |
autoSipEnabled | |
cursorFlashTime | |
doubleClickInterval | |
globalStrut | |
keyboardInputInterval | |
startDragDistance | |
startDragTime | |
styleSheet | |
wheelScrollLines | |
windowIcon | |
![]() | |
applicationDisplayName | |
desktopFileName | |
layoutDirection | |
platformName | |
primaryScreen | |
quitOnLastWindowClosed | |
windowIcon | |
![]() | |
applicationName | |
applicationVersion | |
organizationDomain | |
organizationName | |
quitLockEnabled | |
![]() | |
objectName | |
![]() | |
CustomColor | |
ManyColor | |
NormalColor | |
![]() | |
CodecForTr | |
DefaultCodec | |
Latin1 | |
UnicodeUTF8 | |
![]() | |
typedef | QObjectList |
Detailed Description
Controls and provides information to all KDE applications.
Only one object of this class can be instantiated in a single app. This instance is always accessible via the 'kapp' global variable.
This class provides the following services to all KDE applications.
- It controls the event queue (see QApplication ).
- It provides the application with KDE resources such as accelerators, common menu entries, a KConfig object. session management events, help invocation etc.
- Installs an empty signal handler for the SIGPIPE signal. If you want to catch this signal yourself, you have set a new signal handler after KApplication's constructor has run.
- It can start new services
Controls and provides information to all KDE applications.
Definition at line 76 of file kapplication.h.
Constructor & Destructor Documentation
◆ KApplication() [1/2]
|
explicit |
This constructor is the one you should use.
It takes aboutData and command line arguments from KCmdLineArgs.
- Parameters
-
GUIenabled Set to false to disable all GUI stuff. Note that for a non-GUI daemon, you might want to use QCoreApplication and a KComponentData instance instead. You'll save an unnecessary dependency to kdeui. The main difference is that you will have to do a number of things yourself: - Register to DBus, if necessary.
- Call KLocale::global(), if using multiple threads.
Definition at line 300 of file kapplication.cpp.
◆ KApplication() [2/2]
|
protected |
Used by KUniqueApplication
Definition at line 310 of file kapplication.cpp.
Member Function Documentation
◆ checkRecoverFile()
Check whether an auto-save file exists for the document you want to open.
- Parameters
-
pFilename The full path to the document you want to open. bRecover This gets set to true if there was a recover file.
- Returns
- The full path of the file to open.
Definition at line 902 of file kapplication.cpp.
◆ clearStartupId()
void KApplication::clearStartupId | ( | ) |
Used only by KStartupId.
Definition at line 964 of file kapplication.cpp.
◆ commitData
|
slot |
Slot connected to QGuiApplication::commitDataRequest() to implement highlevel handling of session management with KSessionManager.
Definition at line 545 of file kapplication.cpp.
◆ disableSessionManagement()
void KApplication::disableSessionManagement | ( | ) |
Disables session management for this application.
Useful in case your application is started by the initial "startkde" script.
- Deprecated:
- , use qunsetenv("SESSION_MANAGER") (X11-specific) or
TODO: contribute a QGuiApplication::disableSessionManagement() method
Definition at line 513 of file kapplication.cpp.
◆ enableSessionManagement()
void KApplication::enableSessionManagement | ( | ) |
Enables session management for this application, formerly disabled by calling disableSessionManagement().
You usually shouldn't call this function, as session management is enabled by default.
Definition at line 518 of file kapplication.cpp.
◆ installX11EventFilter()
void KApplication::installX11EventFilter | ( | QWidget * | filter | ) |
- Deprecated:
- since 5.0, use QCoreApplication::installNativeEventFilter Installs widget filter as global X11 event filter.
The widget filter receives XEvents in its standard QWidget::x11Event() function.
Warning: Only do this when absolutely necessary. An installed X11 filter can slow things down.
Definition at line 255 of file kapplication.cpp.
◆ kApplication()
|
static |
Returns the current application object.
This is similar to the global QApplication pointer qApp. It allows access to the single global KApplication object, since more than one cannot be created in the same application. It saves you the trouble of having to pass the pointer explicitly to every function that may require it.
- Returns
- the current application object
Definition at line 493 of file kapplication.cpp.
◆ removeX11EventFilter()
void KApplication::removeX11EventFilter | ( | const QWidget * | filter | ) |
- Deprecated:
- since 5.0, use QCoreApplication::removeNativeEventFilter Removes global X11 event filter previously installed by installX11EventFilter().
Definition at line 272 of file kapplication.cpp.
◆ saveState
|
slot |
Slot connected to QGuiApplication::saveStateRequest() to implement highlevel handling of session management with KSessionManager.
Definition at line 641 of file kapplication.cpp.
◆ saveYourself
|
signal |
- Deprecated:
- since 5.0, connect to saveStateRequest instead
Session management asks you to save the state of your application.
This signal is provided for compatibility only. For new applications, simply use KMainWindow. By reimplementing KMainWindow::queryClose(), KMainWindow::saveProperties() and KMainWindow::readProperties() you can simply handle session management for applications with multiple toplevel windows.
For purposes without KMainWindow, create an instance of KSessionManager and reimplement the functions KSessionManager::commitData() and/or KSessionManager::saveState()
If you still want to use this signal, here is what you should do:
Connect to this signal in order to save your data. Do NOT manipulate the UI in that slot, it is blocked by the session manager.
Use the sessionConfig() KConfig object to store all your instance specific data.
Do not do any closing at this point! The user may still select Cancel wanting to continue working with your application. Cleanups could be done after aboutToQuit().
◆ sessionConfig()
KConfig * KApplication::sessionConfig | ( | ) |
- Deprecated:
- Returns the application session config object.
- Returns
- A pointer to the application's instance specific KConfig object.
- See also
- KConfigGui::sessionConfig
Definition at line 498 of file kapplication.cpp.
◆ sessionSaving()
bool KApplication::sessionSaving | ( | ) | const |
- Deprecated:
- since 5.0, use QGuiApplication::isSavingSession()
Returns true if the application is currently saving its session data (most probably before KDE logout). This is intended for use mainly in KMainWindow::queryClose() and KMainWindow::queryExit().
- See also
- KMainWindow::queryClose
- KMainWindow::queryExit
Definition at line 726 of file kapplication.cpp.
◆ setStartupId()
void KApplication::setStartupId | ( | const QByteArray & | startup_id | ) |
- Deprecated:
- Sets a new value for the application startup notification window property for newly created toplevel windows.
- Parameters
-
startup_id the startup notification identifier
Definition at line 959 of file kapplication.cpp.
◆ setTopWidget()
void KApplication::setTopWidget | ( | QWidget * | topWidget | ) |
Sets the top widget of the application.
This means basically applying the right window caption. An application may have several top widgets. You don't need to call this function manually when using KMainWindow.
- Parameters
-
topWidget A top widget of the application.
- See also
- icon(), caption()
- Deprecated:
- since 5.0. This was doing two things: 1) setting the window title to include the appname; Qt now takes care of that on platforms where this is wanted. 2) setting the window startup ID, which Qt should take care of in the future. -> simply remove this call.
Definition at line 937 of file kapplication.cpp.
◆ startupId()
QByteArray KApplication::startupId | ( | ) | const |
- Deprecated:
- Returns the app startup notification identifier for this running application.
- Returns
- the startup notification identifier
- See also
- KStartupInfo::startupId
Definition at line 954 of file kapplication.cpp.
◆ tempSaveName()
Get a file name in order to make a temporary copy of your document.
- Parameters
-
pFilename The full path to the current file of your document.
- Returns
- A new filename for auto-saving.
- Deprecated:
- use QTemporaryFile, QSaveFile or KAutoSaveFile instead
Definition at line 874 of file kapplication.cpp.
◆ updateRemoteUserTimestamp()
void KApplication::updateRemoteUserTimestamp | ( | const QString & | service, |
int | time = 0 |
||
) |
Updates the last user action timestamp in the application registered to DBUS with id service to the given time, or to this application's user time, if 0 is given.
Use before causing user interaction in the remote application, e.g. invoking a dialog in the application using a DCOP call. Consult focus stealing prevention section in kdebase/kwin/README.
Definition at line 857 of file kapplication.cpp.
◆ updateUserTimestamp
|
slot |
- Deprecated:
- Updates the last user action timestamp to the given time, or to the current time, if 0 is given.
Do not use unless you're really sure what you're doing. Consult focus stealing prevention section in kdebase/kwin/README.
- See also
- KUserTimestamp::updateUserTimestamp
Definition at line 847 of file kapplication.cpp.
◆ userTimestamp()
unsigned long KApplication::userTimestamp | ( | ) | const |
- Deprecated:
- Returns the last user action timestamp or 0 if no user activity has taken place yet.
- See also
- updateuserTimestamp
- KUserTimestamp::userTimestamp
Definition at line 852 of file kapplication.cpp.
Member Data Documentation
◆ KApp
|
staticprotected |
Current application object.
Definition at line 411 of file kapplication.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:56:00 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.