Browse Source

add notes for QTBUG-69963

master
Skycoder42 6 years ago
parent
commit
fd8283c6a1
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 3
      ProjectTemplate/quick_main.cpp
  2. 6
      README.md
  3. 1
      examples/mvvmquick/SampleQuick/main.cpp

3
ProjectTemplate/quick_main.cpp

@ -10,7 +10,8 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 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) // 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); QGuiApplication app(argc, argv);
QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963
qmlRegisterUncreatableType<%{VmCn}>("com.example.%{ProjectLowerName}", 1, 0, "%{VmCn}", "ViewModels cannot be created!"); qmlRegisterUncreatableType<%{VmCn}>("com.example.%{ProjectLowerName}", 1, 0, "%{VmCn}", "ViewModels cannot be created!");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;

6
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/). 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 ### Adding new ViewModels and Views
The most important part is to know how to add new ViewModels and Views. The most important part is to know how to add new ViewModels and Views.

1
examples/mvvmquick/SampleQuick/main.cpp

@ -28,6 +28,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
qDebug() << QQuickStyle::availableStyles() << QQuickStyle::name(); qDebug() << QQuickStyle::availableStyles() << QQuickStyle::name();
QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963
coreApp->setShowDrawer(true); coreApp->setShowDrawer(true);
qmlRegisterUncreatableType<SampleViewModel>("de.skycoder42.QtMvvm.Sample", 1, 1, "SampleViewModel", QStringLiteral("ViewModels cannot be created")); qmlRegisterUncreatableType<SampleViewModel>("de.skycoder42.QtMvvm.Sample", 1, 1, "SampleViewModel", QStringLiteral("ViewModels cannot be created"));

Loading…
Cancel
Save