Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

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

[since 5.1] 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, staticType, (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, staticType, 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.

This macro was introduced in Qt 5.1.

See also Q_GLOBAL_STATIC() and QGlobalStatic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded