Results 1 to 5 of 5

Thread: QML import error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows Android

    Default QML import error

    I wanted to create a new QML type from C++ but I encountered a problem in the process, which I couldn't resolve. I have a class in C++ - "Mytype" - which has been registered with the QML Type System via qmlregistertype function.

    So far so good. The class was correctly registered and the application run fine on desktop environments, everything worked fine. However, when I built and deployed the application to an Android device, I received the following error:

    Warning: QML import could not be resolved in any of the import paths: Mytype
    What does this error talk about? What could be the reason for this error? How can I fix it? Please, help me. Here follows a simplified code example:
    c++:
    Qt Code:
    1. #include <QApplication>
    2. #include <QQmlApplicationEngine>
    3. #include "mytype.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication app(argc, argv);
    8.  
    9. qmlRegisterType<Mytype>("mytype", 1, 0, "Mytype");
    10.  
    11. QQmlApplicationEngine engine;
    12. engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    13.  
    14. return app.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    qml:
    Qt Code:
    1. import mytype 1.0;
    2. ...
    3. Mytype {
    4. id: my_type;
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Dmitriy_RUS; 29th May 2015 at 15:45.

Similar Threads

  1. QML's import does not work
    By MarkoSan in forum Qt Programming
    Replies: 9
    Last Post: 8th September 2014, 13:33
  2. Cannot import my graph
    By Stanfillirenfro in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2014, 21:41
  3. Replies: 3
    Last Post: 6th October 2011, 11:14
  4. How to import qss into another qss file
    By bedbuffer in forum Newbie
    Replies: 1
    Last Post: 4th April 2011, 11:22
  5. import pdf in a QGraphicsView
    By tilsitt in forum Qt Programming
    Replies: 1
    Last Post: 25th March 2011, 16:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.