diff options
author | Pasi Keränen <pasi.keranen@qt.io> | 2019-01-25 15:16:54 +0200 |
---|---|---|
committer | Pasi Keränen <pasi.keranen@qt.io> | 2019-02-06 12:38:42 +0000 |
commit | 50565141cceb780bba1805fc7aab307a34ba27d1 (patch) | |
tree | 1954017cc1d8302253af14768f456ce2a626a6e0 /src/runtime/api/q3dswidget.cpp | |
parent | 8ca98cea890c52a6576a1a277f2acffde9ef965e (diff) |
Add variant filtering
Add variant filtering to loading of presentations.
[ChangeLog][QtStudio3D][Support for variants] Qt 3D Studio runtime now supports loading presentations containing variant tags.
Task-number: QT3DS-2662
Change-Id: Id5637d23f5e9d178b8c40a3bb7c8b8950297548f
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/runtime/api/q3dswidget.cpp')
-rw-r--r-- | src/runtime/api/q3dswidget.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/runtime/api/q3dswidget.cpp b/src/runtime/api/q3dswidget.cpp index 352218b..4700615 100644 --- a/src/runtime/api/q3dswidget.cpp +++ b/src/runtime/api/q3dswidget.cpp @@ -284,7 +284,7 @@ void Q3DSWidget::resizeGL(int w, int h) void Q3DSWidget::paintGL() { Q_D(Q3DSWidget); - if (d->source.isEmpty()) + if (d->sourceInfo.url().isEmpty()) return; // Prevent Qt3D getting confused due its somewhat limited FBO vs. surface @@ -366,8 +366,7 @@ void Q3DSWidgetPrivate::createEngine() initializePresentationController(engine, presentation); - const QString fn = QQmlFile::urlToLocalFileOrQrc(source); - qCDebug(lc3DSWidget, "source is now %s", qPrintable(fn)); + qCDebug(lc3DSWidget, "source is now %s", qPrintable(sourceInfo.fileName())); const QSize sz = q_ptr->size(); if (!sz.isEmpty()) engine->resize(sz); @@ -377,7 +376,7 @@ void Q3DSWidgetPrivate::createEngine() }); QString err; - sourceLoaded = engine->setSource(fn, &err, inlineQmlSubPresentations); + sourceLoaded = engine->setSource(sourceInfo, &err, inlineQmlSubPresentations); if (sourceLoaded) { if (!error.isEmpty()) { error.clear(); @@ -397,7 +396,9 @@ void Q3DSWidgetPrivate::createEngine() emit q_ptr->runningChanged(); } else { - qWarning("Q3DSWidget: Failed to load %s\n%s", qPrintable(fn), qPrintable(err)); + qWarning("Q3DSWidget: Failed to load %s\n%s", + qPrintable(sourceInfo.fileName()), + qPrintable(err)); error = err; emit q_ptr->errorChanged(); emit q_ptr->runningChanged(); @@ -427,17 +428,17 @@ void Q3DSWidgetPrivate::destroyEngine() } } -void Q3DSWidgetPrivate::handlePresentationSource(const QUrl &newSource, +void Q3DSWidgetPrivate::handlePresentationSource(const Q3DSSourceInfo &newSourceInfo, SourceFlags flags, const QVector<Q3DSInlineQmlSubPresentation *> &inlineSubPres) { - if (newSource == source) + if (sourceInfo == newSourceInfo) return; - if (!source.isEmpty()) + if (!sourceInfo.url().isEmpty()) destroyEngine(); - source = newSource; + sourceInfo = newSourceInfo; sourceFlags = flags; inlineQmlSubPresentations = inlineSubPres; @@ -447,7 +448,7 @@ void Q3DSWidgetPrivate::handlePresentationSource(const QUrl &newSource, void Q3DSWidgetPrivate::handlePresentationReload() { - if (source.isEmpty()) + if (sourceInfo.fileName().isEmpty()) return; destroyEngine(); |