From fd8283c6a11b51e6963e776aebb05ecf951dc366 Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Wed, 15 Aug 2018 16:43:09 +0200 Subject: [PATCH] add notes for QTBUG-69963 --- ProjectTemplate/quick_main.cpp | 3 ++- README.md | 6 ++++++ examples/mvvmquick/SampleQuick/main.cpp | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ProjectTemplate/quick_main.cpp b/ProjectTemplate/quick_main.cpp index 90438cb..6a74965 100644 --- a/ProjectTemplate/quick_main.cpp +++ b/ProjectTemplate/quick_main.cpp @@ -10,7 +10,8 @@ int main(int argc, char *argv[]) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // If you want to support file dialogs on platforms other then android, use a QApplication instead (and add QT += widgets to the pro file) QGuiApplication app(argc, argv); - + + QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963 qmlRegisterUncreatableType<%{VmCn}>("com.example.%{ProjectLowerName}", 1, 0, "%{VmCn}", "ViewModels cannot be created!"); QQmlApplicationEngine engine; diff --git a/README.md b/README.md index 47b8d1f..3230380 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,12 @@ Follow the setup to create the project. You can select the GUI-frontends you wan For more Details on these classes, check the [Documentation](https://skycoder42.github.io/QtMvvm/). +**Important:** Due to [QTBUG-69963](https://bugreports.qt.io/browse/QTBUG-69963), you must always link to QtMvvmQuick when creating a QtQuick application for windows (See Issue #1). Since windows optimizes library and only links them if referenced at least once, simply add the line +```.cpp +QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963 +``` +to your `main.cpp` and it should work as expected + ### Adding new ViewModels and Views The most important part is to know how to add new ViewModels and Views. diff --git a/examples/mvvmquick/SampleQuick/main.cpp b/examples/mvvmquick/SampleQuick/main.cpp index 57a9252..11b682e 100644 --- a/examples/mvvmquick/SampleQuick/main.cpp +++ b/examples/mvvmquick/SampleQuick/main.cpp @@ -28,6 +28,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); qDebug() << QQuickStyle::availableStyles() << QQuickStyle::name(); + QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963 coreApp->setShowDrawer(true); qmlRegisterUncreatableType("de.skycoder42.QtMvvm.Sample", 1, 1, "SampleViewModel", QStringLiteral("ViewModels cannot be created"));