Global macros for Hemera

Macros

#define HEMERA_WIDGETS_APPLICATION_MAIN(Class)
 Declares an Application based on QtWidgets. More...
 
#define HEMERA_GUI_APPLICATION_MAIN(Class)
 Declares an Application based on QtGui. More...
 
#define HEMERA_HEADLESS_APPLICATION_MAIN(Class)
 Declares an Application based on QtCore. More...
 
#define HEMERA_QT5_SDK_DEPRECATED
 
#define HEMERA_QT5_SDK_EXPORT_DEPRECATED
 

Detailed Description

Macro Definition Documentation

#define HEMERA_WIDGETS_APPLICATION_MAIN (   Class)

Declares an Application based on QtWidgets.

Place this macro at the end of the main cpp file of your application if your application is going to use QtWidgets. In such a case, a QApplication will be spawned when invoking this macro and the QtWidgets module will be ready for use.

See also
HEMERA_GUI_APPLICATION_MAIN
#define HEMERA_GUI_APPLICATION_MAIN (   Class)

Declares an Application based on QtGui.

Place this macro at the end of the main cpp file of your application if your application is going to use QtGui. In such a case, a QGuiApplication will be spawned when invoking this macro.

See also
HEMERA_WIDGETS_APPLICATION_MAIN
HEMERA_HEADLESS_APPLICATION_MAIN
#define HEMERA_HEADLESS_APPLICATION_MAIN (   Class)

Declares an Application based on QtCore.

Place this macro at the end of the main cpp file of your application if your application is not going to use any GUI feature. Usually, this is the right choice for daemons. A QCoreApplication will be spawned when invoking this macro.

See also
HEMERA_WIDGETS_APPLICATION_MAIN
HEMERA_HEADLESS_APPLICATION_MAIN
#define HEMERA_QT5_SDK_DEPRECATED

The HEMERA_QT5_SDK_DEPRECATED macro can be used to trigger compile-time warnings with newer compilers when deprecated functions are used.

For non-inline functions, the macro gets inserted at front of the function declaration, right before the return type:

1 HEMERA_QT5_SDK_DEPRECATED void deprecatedFunctionA();
2 HEMERA_QT5_SDK_DEPRECATED int deprecatedFunctionB() const;

For functions which are implemented inline, the HEMERA_QT5_SDK_DEPRECATED macro is inserted at the front, right before the return type, but after "static", "inline" or "virtual":

1 HEMERA_QT5_SDK_DEPRECATED void deprecatedInlineFunctionA() { .. }
2 virtual HEMERA_QT5_SDK_DEPRECATED int deprecatedInlineFunctionB() { .. }
3 static HEMERA_QT5_SDK_DEPRECATED bool deprecatedInlineFunctionC() { .. }
4 inline HEMERA_QT5_SDK_DEPRECATED bool deprecatedInlineFunctionD() { .. }

You can also mark whole structs or classes as deprecated, by inserting the HEMERA_QT5_SDK_DEPRECATED macro after the struct/class keyword, but before the name of the struct/class:

1 class HEMERA_QT5_SDK_DEPRECATED DeprecatedClass { };
2 struct HEMERA_QT5_SDK_DEPRECATED DeprecatedStruct { };
Note
If the class you want to deprecate is a QObject and needs to be exported, you should use HEMERA_QT5_SDK_EXPORT_DEPRECATED instead.
It does not make much sense to use the HEMERA_QT5_SDK_DEPRECATED keyword for a Qt signal; this is because usually get called by the class which they belong to, and one would assume that a class author does not use deprecated methods of his own class. The only exception to this are signals which are connected to other signals; they get invoked from moc-generated code. In any case, printing a warning message in either case is not useful. For slots, it can make sense (since slots can be invoked directly) but be aware that if the slots get triggered by a signal, they will get called from moc code as well and thus the warnings are useless.
HEMERA_QT5_SDK_DEPRECATED cannot be used for constructors.
#define HEMERA_QT5_SDK_EXPORT_DEPRECATED

The HEMERA_QT5_SDK_EXPORT_DEPRECATED macro can be used to trigger compile-time warnings with newer compilers when deprecated functions are used, and export the symbol.

This macro simply expands to HEMERA_QT5_SDK_DEPRECATED HEMERA_QT5_SDK_EXPORT, and needs to be used only when you need to deprecate a class which is a QObject and needs to be exported. This is because the following:

1 class HEMERA_QT5_SDK_DEPRECATED HEMERA_QT5_SDK_EXPORT Class : public QObject

Wouldn't be recognized from moc to be a valid QObject class, and hence would be skipped. Instead, you should do:

1 class HEMERA_QT5_SDK_EXPORT_DEPRECATED Class : public QObject

For any other use, please use HEMERA_QT5_SDK_DEPRECATED instead.