Use QtQuick 1 in Qt5



  • Hi
    I have a qml file which imports QtQuick 1.0. It was ok in Qt 4.8 but after porting to qt5.7 it does not work.
    Remember that I don't want to use QtQuick 2. Is there any solution for my problem?
    my code is:
    QQuickView *view = new QQuickView;
    view->setSource(QUrl::fromLocalFile("D:/test/myQml.qml"));
    view->show();



  • You need to use Qt Declarative module for this. This module is removed from Qt 5. 7 and is available as addon-module. You need to use Qt Quick 1.1 in your import statement. Refer to the following guide for more information http://doc.qt.io/qt-5/portingguide.html



  • Thanks for your quick reply but where can I download Qt Declarative addon-module?


  • Lifetime Qt Champion

    Hi,

    You can clone the module on code.qt.io.



  • Hi
    I got qtquick1 from code.qt.io. I compiled it with visual studio 2015 and Qt5.7 but now I have the following errors. Would you please help me with these compile errors?
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(360): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(360): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(361): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(361): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(362): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(362): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(363): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(363): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(364): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(364): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(365): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(365): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(366): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativeanchors_p.h(50): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativeanchors_p.cpp(366): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1> moc_qdeclarativeflickable_p_p.cpp
    1> moc_qdeclarativegraphicswidget_p.cpp
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(87): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativegraphicswidget_p.h(44): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(87): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(88): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativegraphicswidget_p.h(44): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(88): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(89): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativegraphicswidget_p.h(44): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(89): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(90): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativegraphicswidget_p.h(44): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(90): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(91): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativegraphicswidget_p.h(44): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(91): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(92): error C2027: use of undefined type 'QDeclarativeAnchorLine'
    1> c:\qtquick1-dev\src\declarative.moc\release../../graphicsitems/qdeclarativegraphicswidget_p.h(44): note: see declaration of 'QDeclarativeAnchorLine'
    1>.moc\Release\moc_qdeclarativegraphicswidget_p.cpp(92): error C2582: 'operator =' function is unavailable in 'QDeclarativeAnchorLine'
    1> moc_qdeclarativeitem_p.cpp


  • Lifetime Qt Champion

    How did you manage the project ? Did you open it with Qt Creator ?



  • @SGaist
    No I compiled it with visual studio.



  • @SGaist
    I tried to compile it with Qt Creator and I get this errors:

    ..\declarative\graphicsitems\qdeclarativeitem.h(60): Error: Undefined interface


  • Lifetime Qt Champion

    Did you do it from a clean state ?



  • Make sure have the right branch in your clone of the qtquick1 module checked out. If that doesn't help, then I'd assume that the module needs fixing. In that case please submit fixes through code-review or report a bug on bugreports.qt.io. Note that Qt Quick 1 is deprecated and we strongly recommend against using it in new projects.


Log in to reply
 

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