Browse Source

make all qml incubations synchronous

Seems to be a bug with 5.11 where async loading leads to strange errors,
i.e. a crash on an error report of a non existing property that actually
exists...

Check for validity in future versions!
pull/2/head
Skycoder42 7 years ago
parent
commit
b53be20664
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 8
      src/imports/mvvmquick/DialogPresenter.qml
  2. 2
      src/imports/mvvmquick/InputDialog.qml
  3. 9
      src/imports/mvvmquick/SettingsView.qml
  4. 2
      src/imports/mvvmquick/qqmlquickpresenter.cpp
  5. 4
      src/imports/mvvmquick/settingsuibuilder.cpp

8
src/imports/mvvmquick/DialogPresenter.qml

@ -184,7 +184,7 @@ QtObject {
var props = config.viewProperties;
props["msgConfig"] = config;
props["msgResult"] = result;
var incubator = _msgBoxComponent.incubateObject(rootItem, props);
var incubator = _msgBoxComponent.incubateObject(rootItem, props, Qt.Synchronous);
return incubator.status !== Component.Error;
}
@ -204,7 +204,7 @@ QtObject {
var props = config.viewProperties;
props["msgConfig"] = config;
props["msgResult"] = result;
var incubator = _inputComponent.incubateObject(rootItem, props);
var incubator = _inputComponent.incubateObject(rootItem, props, Qt.Synchronous);
return incubator.status !== Component.Error;
}
@ -226,9 +226,9 @@ QtObject {
props["msgResult"] = result;
var incubator = null;
if(config.subType == "folder")
incubator = _folderComponent.incubateObject(rootItem, props);
incubator = _folderComponent.incubateObject(rootItem, props, Qt.Synchronous);
else
incubator = _fileComponent.incubateObject(rootItem, props);
incubator = _fileComponent.incubateObject(rootItem, props, Qt.Synchronous);
return incubator.status !== Component.Error;
}
}

2
src/imports/mvvmquick/InputDialog.qml

@ -38,7 +38,7 @@ MsgBoxBase {
Loader {
id: _inputViewLoad
asynchronous: true
asynchronous: false
clip: true
visible: _inputViewLoad.item

9
src/imports/mvvmquick/SettingsView.qml

@ -256,13 +256,12 @@ Page {
filterText: _searchField.text
onPresentOverview: _overviewComponent.incubateObject(_settingsStack, {
model: model,
showSections: hasSections
}, Qt.Asynchronous)
model: model,
showSections: hasSections
}, Qt.Synchronous)
onPresentSection: _sectionViewComponent.incubateObject(_settingsStack, {
model: model
}, Qt.Asynchronous)
}, Qt.Synchronous)
onCloseSettings: {
_settingsView.fullClose = true;
QuickPresenter.popView();

2
src/imports/mvvmquick/qqmlquickpresenter.cpp

@ -123,7 +123,7 @@ void QQmlQuickPresenter::present(ViewModel *viewModel, const QVariantHash &param
this, &QQmlQuickPresenter::loadingProgressChanged);
connect(_latestComponent, &QQmlComponent::statusChanged,
this, &QQmlQuickPresenter::statusChanged);
_latestComponent->loadUrl(viewUrl, QQmlComponent::Asynchronous);
_latestComponent->loadUrl(viewUrl, QQmlComponent::PreferSynchronous);
}
}

4
src/imports/mvvmquick/settingsuibuilder.cpp

@ -39,7 +39,7 @@ void SettingsUiBuilder::loadSection(const SettingsElements::Section &section)
{
auto inputFactory = QuickPresenterPrivate::currentPresenter()->inputViewFactory();
_entryModel->setup(section, _viewModel, inputFactory);
qmlDebug(this) << "Loaded section" << section.title;
qmlDebug(this) << "Loaded section " << section.title;
emit presentSection(_entryFilterModel);
}
@ -48,7 +48,7 @@ void SettingsUiBuilder::showDialog(const QString &key, const QString &title, con
if(type == QStringLiteral("action"))
_viewModel->callAction(key, properties.value(QStringLiteral("args")).toMap());
else {
qmlDebug(this) << "Creating input dialog for settings entry" << key;
qmlDebug(this) << "Creating input dialog for settings entry " << key;
getInput(title + tr(":"), QString(), qUtf8Printable(type), this, [this, key](const QVariant &value) {
if(value.isValid())
_viewModel->saveValue(key, value);

Loading…
Cancel
Save