QML plugin don't work while using QDeclarativeView to load can work



  • today I tried the demo QML plugin of qt on winows 7 x64 , it is in examples/declarative/tutorials/extending/chapter6-plugins ,
    at first I build with qmake , mingw32-make , it said error
    libsupc++/vterminate.cc:91: undefined reference to `_imp___iob'
    and I searched it with google , and found some people meet the same problem , and the solution is to copy this project to other disc , then
    I copy to E://qt/demo , and build with qmake , mingw32-make , and but still it doesn't work , it seems everything is right , I can get the
    dll output in lib , while when I run app.qml , it said PieChart is not a type "PieChart" .
    then I tried to build them in main.cpp, see main.cpp
    @
    #include <QtDeclarative/QtDeclarative>
    #include <QtGui/QtGui>
    #include "piechart.h"
    #include "pieslice.h"

    int main(int argc,char **argv)
    {
    QApplication app(argc,argv);
    qmlRegisterType<PieChart>("Bruce",1,0,"PieChart");
    qmlRegisterType<PieSlice>("Bruce",1,0,"PieSlice");
    QDeclarativeView view;
    view.setSource(QUrl("Test.qml"));
    view.show();
    return app.exec();
    }
    @
    and Tested , it works , why the plugins don't work , while using QDeclarativeView to load them can work .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.