Hi

I am trying to use QMetaType::metaObjectForType but it is always returning NULL

I have attached my class declaration and would be grateful if anyone can 
explain why I am getting a NULL return value

Many thanks
Class.h -
class Widget : public QWidget
{
    Q_OBJECT

public:
    Q_INVOKABLE Widget(QWidget *parent=0);
    Widget(const Widget& other);
    ~Widget();
};

Q_DECLARE_METATYPE(Widget)

Class.cpp
const int WidgetTypeID = qRegisterMetaType<Widget>("Widget");

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
}

Widget::~Widget()
{
}

Widget::Widget(const Widget& other)
{
    Q_UNUSED(other)
}

Usage
        int id = QMetaType::type("Widget");
        const QMetaObject* baseMetaObject = QMetaType::metaObjectForType(id);
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to