forked from qt-creator/qt-creator
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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user