forked from qt-creator/qt-creator
QmlDesigner: Fix import preview generation crashes
Asset name sanitizing logic is more complex on quick3d importer than we have on designer side, which leads to asset name sometimes differing from actual generated qml file name. Since there's always a risk of sanitizing logic changing, added qml name as separate data item from asset name so that preview generation knows to always load correct qml. Fixes: QDS-13168 Change-Id: I1705619a6b30ebbe8ca44a00cfdad1a5122ca964 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -115,6 +115,7 @@ void Qt5Import3dNodeInstanceServer::view3DAction([[maybe_unused]] const View3DAc
|
||||
case View3DActionType::Import3dAddPreviewModel: {
|
||||
const QVariantHash cmd = command.value().toHash();
|
||||
const QString name = cmd["name"].toString();
|
||||
const QString qmlName = cmd["qmlName"].toString();
|
||||
const QString folder = cmd["folder"].toString();
|
||||
|
||||
bool isUpdate = m_previewData.contains(name);
|
||||
@@ -136,7 +137,7 @@ void Qt5Import3dNodeInstanceServer::view3DAction([[maybe_unused]] const View3DAc
|
||||
}
|
||||
|
||||
QFileInfo fi(fileUrl().toLocalFile());
|
||||
QString compPath = fi.absolutePath() + '/' + folder + '/' + name + ".qml";
|
||||
QString compPath = fi.absolutePath() + '/' + folder + '/' + qmlName + ".qml";
|
||||
QQmlComponent comp(engine(), compPath, QQmlComponent::PreferSynchronous);
|
||||
data.node = qobject_cast<QQuick3DNode *>(comp.create(context()));
|
||||
if (data.node) {
|
||||
|
||||
Reference in New Issue
Block a user