EffectMaker: confirm save changes before opening an composition

Change-Id: I05659e4cdeba5dc5f437d2fb99bc3768c6a1522d
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
Mahmoud Badri
2023-12-12 15:15:15 +02:00
parent 9d8aa76b4c
commit d9774e7faf
4 changed files with 35 additions and 11 deletions

View File

@@ -12,7 +12,6 @@
//#include "qmldesigner/designercore/imagecache/midsizeimagecacheprovider.h"
#include "qmldesignerconstants.h"
#include "qmldesignerplugin.h"
#include "qqmlcontext.h"
#include "theme.h"
#include <coreplugin/icore.h>
@@ -30,7 +29,9 @@
#include <utils/qtcassert.h>
#include <QHBoxLayout>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQuickItem>
#include <QTimer>
namespace EffectMaker {
@@ -193,6 +194,21 @@ void EffectMakerWidget::initView()
reloadQmlSource();
}
void EffectMakerWidget::openComposition(const QString &path)
{
m_compositionPath = path;
if (effectMakerModel()->hasUnsavedChanges())
QMetaObject::invokeMethod(quickWidget()->rootObject(), "promptToSaveBeforeOpen");
else
doOpenComposition();
}
void EffectMakerWidget::doOpenComposition()
{
effectMakerModel()->openComposition(m_compositionPath);
}
void EffectMakerWidget::reloadQmlSource()
{
const QString effectMakerQmlPath = qmlSourcesPath() + "/EffectMaker.qml";