Results 1 to 3 of 3

Thread: Error: plugin cannot be loaded for module "QtQuick".

  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default Error: plugin cannot be loaded for module "QtQuick".

    Hi,

    I am running my app with open source Qt 5.1.1 using QtQuick2ApplicationViewer on Windows 7. Application builds fine whenever i try to run I get plugin cannot be loaded for module "QtQuick".I feel there is something wrong with qmlRegisterType.

    main.qml

    Qt Code:
    1. import QtQuick 2.0
    2.  
    3. Item {
    4. width: 800
    5. height: 600
    6.  
    7. Row {
    8. id: layoutRow
    9.  
    10. TextButton {
    11. text: "1x1"
    12. onClicked: { workspaceWidget.setLayout(WorkspaceWidget.Layout_1x1) }
    13. }
    14.  
    15. TextButton {
    16. text: "2x2"
    17. onClicked: { workspaceWidget.setLayout(WorkspaceWidget.Layout_2x2) }
    18. }
    19.  
    20. }
    21.  
    22. }
    To copy to clipboard, switch view to plain text mode 

    main.cpp

    Qt Code:
    1. #include <QtGui/QGuiApplication>
    2. #include "qtquick2applicationviewer.h"
    3. #include <QQmlContext>
    4. #include <QtQml>
    5. #include "WorkspaceWidget.h"
    6.  
    7. int main(int argc, char *argv[])
    8. {
    9. QGuiApplication app(argc, argv);
    10. QtQuick2ApplicationViewer viewer;
    11.  
    12. WorkspaceWidget workspacePane;
    13. viewer.rootContext()->setContextProperty(QLatin1String("workspaceWidget"), &workspacePane);
    14. viewer.setResizeMode(QQuickView::SizeRootObjectToView);
    15.  
    16. qmlRegisterType<WorkspaceWidget>("QtQuick", 2, 0, "WorkspaceWidget");
    17.  
    18. viewer.setMainQmlFile(QStringLiteral("qml/QtQuick2Demo/main.qml"));
    19. viewer.showExpanded();
    20. return app.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 


    I am getting following error in debug pane in Qt Creator

    Qt Code:
    1. file:///C:/Projects/build-QtQuick2Demo-Desktop_Qt_5_1_1_MSVC2010_32bit-Debug/qml/QtQuick2Demo/main.qml:1:1: plugin cannot be loaded for module "QtQuick": Namespace 'QtQuick' has already been used for type registration
    2. import QtQuick 2.0
    3. ^
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2013
    Posts
    10
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Error: plugin cannot be loaded for module "QtQuick".

    it tells you exactly the problem, QtQuick is already taken

    qmlRegisterType<WorkspaceWidget>("user_mail07", 2, 0, "WorkspaceWidget");

  3. #3
    Join Date
    Apr 2015
    Posts
    26
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Error: plugin cannot be loaded for module "QtQuick".

    You don't really provide a lot of information. Based on what's there the answer has been given already. Generally you need these steps:

    1. Create c++ class that contains the Q_OBJECT macro
    Qt Code:
    1. class WorkspaceWidget
    2. {
    3. Q_OBJECT
    4. public:
    5. // your implementatin goes here...
    6. // whatever function you want to call from qml must be made invokable with the proper macro declaration
    7. Q_INVOKABLE void foo();
    8. }
    To copy to clipboard, switch view to plain text mode 

    2. Register the class in main.cpp
    Qt Code:
    1. qmlRegisterType<WorkspaceWidget>("WorkspaceWidgetNameSpace", 2, 0, "WorkspaceWidgetQml");
    2.  
    3. // WorkspaceWidget: Your class
    4. // WorkspaceWidgetNameSpace: a namespace that has not yet been used. Can be anything, but must be unique
    5. // WorkspaceWidgetQml: Some name that you give to handle it in a qml file. Can be anything, but must be unique
    To copy to clipboard, switch view to plain text mode 

    3. in some qml-file
    Qt Code:
    1. // import your name space with major and minor version
    2. import WorkspaceWidgetNameSpace 2.0
    3.  
    4.  
    5. // declare your class, as qml is a declarative environment
    6. WorkspaceWidgetQml {
    7. id: workspaceWidgetID
    8. }
    9.  
    10. // do with it what you want
    11. TextButton {
    12. text: "1x1"
    13. onClicked: { workspaceWidgetID.setLayout(WorkspaceWidget.Layout_1x1); }
    14. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 0
    Last Post: 14th September 2012, 19:46
  2. Replies: 32
    Last Post: 25th August 2012, 23:10
  3. error:module "com.nokia.symbian" is not installed
    By vinayaka in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2012, 07:39
  4. Replies: 1
    Last Post: 18th December 2010, 11:05
  5. The PostgreSQL plugin is not loaded in "SQL Browser" example
    By Scratch in forum Installation and Deployment
    Replies: 1
    Last Post: 18th November 2008, 01:30

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.