Obsolete Members for QGlobalStatic
The following members of class QGlobalStatic are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.
Public Functions
(deprecated) QGlobalStatic::Type * | operator()() |
Macros
(deprecated) | Q_GLOBAL_STATIC_WITH_ARGS(Type, VariableName, Arguments) |
Member Function Documentation
QGlobalStatic::Type *QGlobalStatic::operator()()
This function is deprecated. We strongly advise against using it in new code.
This function returns the address of the contents of this global static. If the contents have not yet been created, they will be created thread-safely by this function. If the contents have already been destroyed, this function will return a null pointer.
This function is equivalent to operator Type *(). It is provided for compatibility with the private Q_GLOBAL_STATIC implementation that existed in Qt 4.x and 5.0. New code should avoid using it and should instead treat the object as a smart pointer.
Macro Documentation
Q_GLOBAL_STATIC_WITH_ARGS(Type, VariableName, Arguments)
This macro is deprecated. We strongly advise against using it in new code.
Creates a global and static object of type QGlobalStatic, of name VariableName, initialized by the arguments Arguments and that behaves as a pointer to Type. The object created by Q_GLOBAL_STATIC_WITH_ARGS initializes itself on the first use, which means that it will not increase the application or the library's load time. Additionally, the object is initialized in a thread-safe manner on all platforms.
The typical use of this macro is as follows, in a global context (that is, outside of any function bodies):
Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42, "Hello", "World"))
The Arguments macro parameter must always include the parentheses or, if C++11 uniform initialization is allowed, the braces. The above call is equivalent to
Q_GLOBAL_STATIC(MyType, myGlobal, 42, "Hello", "World")
Aside from the actual initialization of the contents with the supplied arguments, this macro behaves identically to Q_GLOBAL_STATIC(). Please see that macro's documentation for more information.
See also Q_GLOBAL_STATIC() and QGlobalStatic.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.