Right now I have a header file called enums.h as such:
enums.h
Code:
#ifndef ENUMS_H #define ENUMS_H #include <Qt> enum paper_orient{portrait, landscape}; enum ruler_orient{top_ruler, bottom_ruler, left_ruler, right_ruler}; enum relationships_type{line_item, other}; enum settings_type{line_object, plot, text}; #endif // ENUMS_H
With this setup, wherever I want to use these enums, I just #include "enums.h" and they are available.
In learning to do things the Qt way, it appears that QMetaEnum would be a more streamlined approach.
In the docs, I find this example:
Code:
{ Q_OBJECT Q_ENUMS(Priority) public: ~MyClass(); enum Priority { High, Low, VeryHigh, VeryLow }; void setPriority(Priority priority); Priority priority() const; };
If I use this approach, does this mean that the Priority enum is only available within MyClass? What if I wish to use this enum in other classes? Ultimately that is what I would like to establish, is a series of global enums that are available anywhere in my project.