How to use Q_GLOBAL_STATIC with QMap
Solved
General and Desktop
-
wrote on 10 Jul 2024, 11:56 last edited by
I want to write code like this:
Q_GLOBAL_STATIC(QMap<QString, MyType>, myTypeList>
But the comma in QMap just confuses Q_GLOBAL_STATIC. What can I do about this? Maybe just use non-POD global statics?
-
Typedef the QMap to a new type and use this in Q_GLOBAL_STATIC
-
Typedef the QMap to a new type and use this in Q_GLOBAL_STATIC
wrote on 10 Jul 2024, 12:29 last edited by@Christian-Ehrlicher Thanks a lot!
-
-
Typedef the QMap to a new type and use this in Q_GLOBAL_STATIC
wrote on 11 Jul 2024, 06:32 last edited by@Christian-Ehrlicher said in How to use Q_GLOBAL_STATIC with QMap:
Typedef the QMap
I always found typedef at least a little confusing. With modern C++ we can use
using
to "typedef" new types.I would assume that also putting QMap<QString, MyType> into parentheses, i.e. ( and ), would work because this is a macro to be expanded.
4/4