KDELibs4Support
kglobal.h
Go to the documentation of this file.
83 * MSVC seems to give anonymous structs the same name which fails at link time. So instead we name
84 * the struct and hope that by adding the line number to the name it's unique enough to never clash.
109 * If you have code that might be called after the global object has been destroyed you can check
113 * global statics (e.g. KConfig::sync) your destructor has to be called before those global statics
114 * are destroyed. A Qt post routine does that.) you can also install a post routine (qAddPostRoutine) to clean up the object
115 * using the destroy() method. If you registered a post routine and the object is destroyed because
161 * A common case for the need of deletion on lib unload/app shutdown are Singleton classes. Here's
201 * Instead of the above you can use also the following pattern (ignore the name of the namespace):
364 KDELIBS4SUPPORT_DEPRECATED_EXPORT const KComponentData &mainComponent(); //krazy:exclude=constref (don't mess up ref-counting)
369 * @deprecated since 5.0, use KComponentData::hasMainComponent() if you really need a KComponentData
402 * @deprecated since 5.0, port to if (qApp) because KLocale::global() can be called, as soon as a qApp exists.
437 KDELIBS4SUPPORT_DEPRECATED_EXPORT const QString &staticQString(const char *str); //krazy:exclude=constref (doesn't make sense otherwise)
457 KDELIBS4SUPPORT_DEPRECATED_EXPORT const QString &staticQString(const QString &str); //krazy:exclude=constref (doesn't make sense otherwise)
468 * - job start 1; job end 0 [don't exit yet]; open window -> setAllowQuit(true) 1 ; close window 0 => EXIT
474 * - open window -> setAllowQuit(true) 1; add systray icon 2; remove systray icon 1; close window 0 => EXIT
475 * - unit test which opens and closes many windows: should call ref() to avoid subevent-loops quitting too early.
502 * _what_ is making your application still alive to the user (like a systray icon or a D-Bus object)
539 * If you really need this, use QGuiApplication::applicationDisplayName(), and if that's empty, QCoreApplication::applicationName().
544 KDELIBS4SUPPORT_DEPRECATED_EXPORT QObject *findDirectChild_helper(const QObject *parent, const QMetaObject &mo);
547 * Returns the child of the given object that can be cast into type T, or 0 if there is no such object.
555 return static_cast<T>(findDirectChild_helper(object, (static_cast<T>(nullptr))->staticMetaObject));
T findDirectChild(const QObject *object)
Returns the child of the given object that can be cast into type T, or 0 if there is no such object.
Definition: kglobal.h:553
void ref()
Tells KGlobal about one more operations that should be finished before the application exits.
Definition: kglobal.cpp:207
KComponentData activeComponent()
The component currently active (useful in a multi-component application, such as a KParts application...
Definition: kglobal.cpp:138
void deref()
Tells KGlobal that one operation such as those described in ref() just finished.
Definition: kglobal.cpp:213
void setAllowQuit(bool allowQuit)
If refcounting reaches 0 (or less), and allowQuit is true, the instance of the application will autom...
Definition: kglobal.cpp:222
void setActiveComponent(const KComponentData &d)
Set the active component for use by KAboutDialog and KBugReport.
Definition: kglobal.cpp:143
QObject * findDirectChild_helper(const QObject *parent, const QMetaObject &mo)
Definition: kglobal.cpp:229
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 1 2023 03:59:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 1 2023 03:59:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.