user_mail07
6th November 2013, 19:49
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
import QtQuick 2.0
Item {
width: 800
height: 600
Row {
id: layoutRow
TextButton {
text: "1x1"
onClicked: { workspaceWidget.setLayout(WorkspaceWidget.Layout_1 x1) }
}
TextButton {
text: "2x2"
onClicked: { workspaceWidget.setLayout(WorkspaceWidget.Layout_2 x2) }
}
}
}
main.cpp
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#include <QQmlContext>
#include <QtQml>
#include "WorkspaceWidget.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
WorkspaceWidget workspacePane;
viewer.rootContext()->setContextProperty(QLatin1String("workspaceWidget"), &workspacePane);
viewer.setResizeMode(QQuickView::SizeRootObjectToV iew);
qmlRegisterType<WorkspaceWidget>("QtQuick", 2, 0, "WorkspaceWidget");
viewer.setMainQmlFile(QStringLiteral("qml/QtQuick2Demo/main.qml"));
viewer.showExpanded();
return app.exec();
}
I am getting following error in debug pane in Qt Creator
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
import QtQuick 2.0
^
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
import QtQuick 2.0
Item {
width: 800
height: 600
Row {
id: layoutRow
TextButton {
text: "1x1"
onClicked: { workspaceWidget.setLayout(WorkspaceWidget.Layout_1 x1) }
}
TextButton {
text: "2x2"
onClicked: { workspaceWidget.setLayout(WorkspaceWidget.Layout_2 x2) }
}
}
}
main.cpp
#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"
#include <QQmlContext>
#include <QtQml>
#include "WorkspaceWidget.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer;
WorkspaceWidget workspacePane;
viewer.rootContext()->setContextProperty(QLatin1String("workspaceWidget"), &workspacePane);
viewer.setResizeMode(QQuickView::SizeRootObjectToV iew);
qmlRegisterType<WorkspaceWidget>("QtQuick", 2, 0, "WorkspaceWidget");
viewer.setMainQmlFile(QStringLiteral("qml/QtQuick2Demo/main.qml"));
viewer.showExpanded();
return app.exec();
}
I am getting following error in debug pane in Qt Creator
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
import QtQuick 2.0
^