How can the same constants be shared between C++ and QML?
↗ Original Qt Forum discussionQM • Qt Forum member • September 11, 2026 • 1 answers
A developer wanted one definition for many constants used from both C++ and QML.
A developer wanted one definition for many constants used from both C++ and QML.
class Constants { Q_GADGET public: enum Value { MinValue=0, MaxValue=100 }; Q_ENUM(Value) };
Explain your own solution first; add reusable code if needed.