#ifndef Toolbox_Singleton_Widget_H
#define Toolbox_Singleton_Widget_H
#include <QDebug>
namespace Toolbox {
    template<typename T>
    class Singleton_Widget {
    public:
        static T *instance() {
            if (!instance) {
                qInfo() << "error Singleton_Widget 未创建" << instance;
            }
            return instance;
        }
        Singleton_Widget() {
            if (instance) {
                qInfo() << "error Singleton_Widget 重复创建" << instance;
            }
            instance = static_cast<T *>(this);
        }
        virtual ~Singleton_Widget() {}
        Singleton_Widget(T &&) = delete;
        Singleton_Widget(const T &) = delete;
        void operator=(const T &) = delete;
    protected:
        static T *instance;
    };
    template<typename T> T *Singleton_Widget<T>::instance = nullptr;
}
#endif
