Singleton Class

template <typename T> class Qul::Singleton

Inherit from this class to expose this class from QML as a singleton. More...

Header: #include <Singleton>
Inherits: Qul::Object

Static Public Members

T &instance()

Detailed Description

qmlinterface extractor will generate "pragma Singleton" for class derived from singleton.

This class use the Curiously recurring template pattern (CRTP) and the template parameter needs to be the derived type.


struct MySingleton : public Qul::Singleton<MySingleton>
    Property<int> someProperty;
    int someFunction(int param);

Member Function Documentation

[static] T &Singleton::instance()

Returns a reference the singleton instance

Available under certain Qt licenses.
Find out more.