diff options
Diffstat (limited to 'src')
10 files changed, 17 insertions, 53 deletions
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp index 997852cfb2..cf1f377141 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp @@ -85,12 +85,6 @@ void StatesEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorV checkForStatesAvailability(); } -void StatesEditorView::toggleStatesViewExpanded() -{ - if (m_statesEditorWidget) - m_statesEditorWidget->toggleStatesViewExpanded(); -} - void StatesEditorView::removeState(int nodeId) { try { @@ -102,6 +96,22 @@ void StatesEditorView::removeState(int nodeId) if (modelState.isValid()) { QStringList lockedTargets; const auto propertyChanges = modelState.propertyChanges(); + + // confirm removing not empty states + if (!propertyChanges.isEmpty()) { + QMessageBox msgBox; + msgBox.setTextFormat(Qt::RichText); + msgBox.setIcon(QMessageBox::Question); + msgBox.setWindowTitle(tr("Remove State")); + msgBox.setText(tr("This state is not empty. Are you sure you want to remove it?")); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Yes); + + if (msgBox.exec() == QMessageBox::Cancel) + return; + } + + // confirm removing states with locked targets for (const QmlPropertyChanges &change : propertyChanges) { const ModelNode target = change.target(); QTC_ASSERT(target.isValid(), continue); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h index 1ac7a6f39f..71a82711ea 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h @@ -87,8 +87,6 @@ public: void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) override; - void toggleStatesViewExpanded(); - public slots: void synchonizeCurrentStateFromWidget(); void createNewState(); diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 4701a4079e..b7b391944a 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -133,13 +133,6 @@ QString StatesEditorWidget::qmlSourcesPath() return Core::ICore::resourcePath("qmldesigner/statesEditorQmlSources").toString(); } -void StatesEditorWidget::toggleStatesViewExpanded() -{ - QTC_ASSERT(rootObject(), return); - bool expanded = rootObject()->property("expanded").toBool(); - rootObject()->setProperty("expanded", !expanded); -} - void StatesEditorWidget::showEvent(QShowEvent *event) { QQuickWidget::showEvent(event); @@ -168,18 +161,6 @@ void StatesEditorWidget::reloadQmlSource() connect(rootObject(), SIGNAL(createNewState()), m_statesEditorView.data(), SLOT(createNewState())); connect(rootObject(), SIGNAL(deleteState(int)), m_statesEditorView.data(), SLOT(removeState(int))); m_statesEditorView.data()->synchonizeCurrentStateFromWidget(); - - if (!DesignerSettings::getValue(DesignerSettingsKey::STATESEDITOR_EXPANDED).toBool()) - toggleStatesViewExpanded(); - - connect(rootObject(), SIGNAL(expandedChanged()), this, SLOT(handleExpandedChanged())); } -void StatesEditorWidget::handleExpandedChanged() -{ - QTC_ASSERT(rootObject(), return); - - bool expanded = rootObject()->property("expanded").toBool(); - DesignerSettings::setValue(DesignerSettingsKey::STATESEDITOR_EXPANDED, expanded); -} -} +} // QmlDesigner diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h index e4e9668abb..b613e600c4 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.h @@ -57,14 +57,11 @@ public: static QString qmlSourcesPath(); - void toggleStatesViewExpanded(); - protected: void showEvent(QShowEvent *) override; private: void reloadQmlSource(); - Q_SLOT void handleExpandedChanged(); private: QPointer<StatesEditorView> m_statesEditorView; diff --git a/src/plugins/qmldesigner/designercore/include/viewmanager.h b/src/plugins/qmldesigner/designercore/include/viewmanager.h index af4bf8bb24..114c143e6a 100644 --- a/src/plugins/qmldesigner/designercore/include/viewmanager.h +++ b/src/plugins/qmldesigner/designercore/include/viewmanager.h @@ -94,8 +94,6 @@ public: DesignerActionManager &designerActionManager(); const DesignerActionManager &designerActionManager() const; - void toggleStatesViewExpanded(); - void qmlJSEditorContextHelp(const Core::IContext::HelpCallback &callback) const; DesignDocument *currentDesignDocument() const; diff --git a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp index c20ecf4b61..01e5f3e4c6 100644 --- a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp +++ b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp @@ -405,11 +405,6 @@ const DesignerActionManager &ViewManager::designerActionManager() const return d->designerActionManagerView.designerActionManager(); } -void ViewManager::toggleStatesViewExpanded() -{ - d->statesEditorView.toggleStatesViewExpanded(); -} - void ViewManager::qmlJSEditorContextHelp(const Core::IContext::HelpCallback &callback) const { d->textEditorView.qmlJSEditorContextHelp(callback); diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 08788ca5be..8ecaaa6edd 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -72,7 +72,6 @@ void DesignerSettings::fromSettings(QSettings *settings) restoreValue(settings, DesignerSettingsKey::FORWARD_PUPPET_OUTPUT, QString()); restoreValue(settings, DesignerSettingsKey::REFORMAT_UI_QML_FILES, true); restoreValue(settings, DesignerSettingsKey::IGNORE_DEVICE_PIXEL_RATIO, false); - restoreValue(settings, DesignerSettingsKey::STATESEDITOR_EXPANDED, true); restoreValue(settings, DesignerSettingsKey::NAVIGATOR_SHOW_ONLY_VISIBLE_ITEMS, true); restoreValue(settings, DesignerSettingsKey::NAVIGATOR_REVERSE_ITEM_ORDER, false); restoreValue(settings, DesignerSettingsKey::STANDALONE_MODE, false); diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index 0afb86d6dd..bb25e2e04c 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -60,7 +60,6 @@ const char ENABLE_MODEL_EXCEPTION_OUTPUT[] = "WarnException"; const char PUPPET_KILL_TIMEOUT[] = "PuppetKillTimeout"; const char DEBUG_PUPPET[] = "DebugPuppet"; const char FORWARD_PUPPET_OUTPUT[] = "ForwardPuppetOutput"; -const char STATESEDITOR_EXPANDED[] = "StatesEditorExpanded"; const char NAVIGATOR_SHOW_ONLY_VISIBLE_ITEMS[] = "NavigatorShowOnlyVisibleItems"; const char NAVIGATOR_REVERSE_ITEM_ORDER[] = "NavigatorReverseItemOrder"; const char REFORMAT_UI_QML_FILES[] = "ReformatUiQmlFiles"; /* These settings are not exposed in ui. */ diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp index 25d1c27c47..e82e7a04c0 100644 --- a/src/plugins/qmldesigner/shortcutmanager.cpp +++ b/src/plugins/qmldesigner/shortcutmanager.cpp @@ -69,7 +69,6 @@ ShortCutManager::ShortCutManager() m_copyAction(tr("&Copy")), m_pasteAction(tr("&Paste")), m_selectAllAction(tr("Select &All")), - m_collapseExpandStatesAction(tr("Toggle States")), m_escapeAction(this) { @@ -97,10 +96,6 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex connect(&m_selectAllAction,&QAction::triggered, this, &ShortCutManager::selectAll); - connect(&m_collapseExpandStatesAction, &QAction::triggered, [] { - QmlDesignerPlugin::instance()->viewManager().toggleStatesViewExpanded(); - }); - // Revert to saved Core::EditorManager *em = Core::EditorManager::instance(); Core::ActionManager::registerAction(&m_revertToSavedAction,Core::Constants::REVERTTOSAVED, qmlDesignerMainContext); @@ -188,13 +183,6 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex command->setDefaultKeySequence(QKeySequence::SelectAll); editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL); - Core::ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS); - - command = Core::ActionManager::registerAction(&m_collapseExpandStatesAction, Constants::TOGGLE_STATES_EDITOR, qmlDesignerMainContext); - command->setAttribute(Core::Command::CA_Hide); - command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+s")); - viewsMenu->addAction(command); - /* Registering disabled action for Escape, because Qt Quick does not support shortcut overrides. */ command = Core::ActionManager::registerAction(&m_escapeAction, Core::Constants::S_RETURNTOEDITOR, qmlDesignerMainContext); command->setDefaultKeySequence(QKeySequence(Qt::Key_Escape)); diff --git a/src/plugins/qmldesigner/shortcutmanager.h b/src/plugins/qmldesigner/shortcutmanager.h index 6e5b5ec23b..4bc4ae5f84 100644 --- a/src/plugins/qmldesigner/shortcutmanager.h +++ b/src/plugins/qmldesigner/shortcutmanager.h @@ -83,7 +83,6 @@ private: QAction m_copyAction; QAction m_pasteAction; QAction m_selectAllAction; - QAction m_collapseExpandStatesAction; QAction m_escapeAction; }; |