forked from qt-creator/qt-creator
qmldesigner: fix crash while switching modes
Task-number: QDS-7984 Change-Id: Ia1803ce062c3956390c12f0da5b86577593fd721 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -302,7 +302,7 @@ void MaterialBrowserView::modelAttached(Model *model)
|
||||
|
||||
// Project load is already very busy and may even trigger puppet reset, so let's wait a moment
|
||||
// before refreshing the model
|
||||
QTimer::singleShot(1000, this, [this]() {
|
||||
QTimer::singleShot(1000, model, [this]() {
|
||||
refreshModel(true);
|
||||
loadPropertyGroups(); // Needs the delay because it uses metaInfo
|
||||
});
|
||||
@@ -310,9 +310,6 @@ void MaterialBrowserView::modelAttached(Model *model)
|
||||
|
||||
void MaterialBrowserView::refreshModel(bool updateImages)
|
||||
{
|
||||
if (!model() || !model()->nodeInstanceView())
|
||||
return;
|
||||
|
||||
ModelNode matLib = modelNodeForId(Constants::MATERIAL_LIB_ID);
|
||||
QList <ModelNode> materials;
|
||||
|
||||
@@ -581,7 +578,7 @@ void MaterialBrowserView::customNotification(const AbstractView *view, const QSt
|
||||
if (idx != -1)
|
||||
m_widget->materialBrowserModel()->selectMaterial(idx);
|
||||
} else if (identifier == "refresh_material_browser") {
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
QTimer::singleShot(0, model(), [this]() {
|
||||
refreshModel(true);
|
||||
});
|
||||
} else if (identifier == "delete_selected_material") {
|
||||
|
Reference in New Issue
Block a user