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