hi guys,
I’ve came across with a very strange problem. Namely I created a new “Qt Quick 2” project and then wanted to extend functionality with C++, for that I declared a class like this :
#include <QtDeclarative/QDeclarativeItem>
class MyChart: public QDeclarativeItem
{
Q_OBJECT
public:
MyChart(QDeclarativeItem *parent = 0);
};
MyChart::MyChart(QDeclarativeItem *parent)
: QDeclarativeItem(parent)
{
}
In main.cpp file I added this line:
qmlRegisterType<MyChart>("MyChart", 1, 0, "MyChart");
and after that I tried to import new module in my QML file, like this
import MyChart 1.0
in .pro file I’ve added this line: QT += declarative
So, I’m able to compile the application, but when I run it, I’ve got an error:
module "MyChart" is not installed
import MyChart 1.0
^
Unable to find a renderable master window QtQuick2ApplicationViewer(0x2afda4) when trying to render QtQuick2ApplicationViewer(0x2afda4) ( QRect(8,30 116x0) ).
I’m using Qt Creator 2.6.2 based on Qt 5.0.1 from revision 55e2124f32
So, maybe someone had similar problem and can share the solution? I would really appreciate any advice. Thanks a lot
↧