forked from qt-creator/qt-creator
QmlDesigner: Move global annotations to edit mode
Task-number: QDS-9194 Change-Id: Iadba8028e5c4c91195413094086ec5c87329dff3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
9b06fa46fb
commit
1cbbcea8cc
@@ -245,12 +245,13 @@ Rectangle {
|
|||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: annotations
|
id: annotations
|
||||||
|
visible: false
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: shareButton.left
|
anchors.right: shareButton.left
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
tooltip: qsTr("Edit Annotations")
|
tooltip: qsTr("Edit Annotations")
|
||||||
buttonIcon: StudioTheme.Constants.annotations_large
|
buttonIcon: StudioTheme.Constants.annotations_large
|
||||||
visible: !root.flyoutEnabled
|
//visible: !root.flyoutEnabled
|
||||||
|
|
||||||
onClicked: backend.editGlobalAnnoation()
|
onClicked: backend.editGlobalAnnoation()
|
||||||
}
|
}
|
||||||
@@ -358,6 +359,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
|
visible: false
|
||||||
style: StudioTheme.Values.statusbarButtonStyle
|
style: StudioTheme.Values.statusbarButtonStyle
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
tooltip: qsTr("Edit Annotations")
|
tooltip: qsTr("Edit Annotations")
|
||||||
|
@@ -159,13 +159,7 @@ void ToolBarBackend::setCurrentWorkspace(const QString &workspace)
|
|||||||
|
|
||||||
void ToolBarBackend::editGlobalAnnoation()
|
void ToolBarBackend::editGlobalAnnoation()
|
||||||
{
|
{
|
||||||
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_EDIT_GLOBAL_ANNOTATION);
|
launchGlobalAnnotations();
|
||||||
ModelNode node = currentDesignDocument()->rewriterView()->rootModelNode();
|
|
||||||
|
|
||||||
if (node.isValid()) {
|
|
||||||
designModeWidget()->globalAnnotationEditor().setModelNode(node);
|
|
||||||
designModeWidget()->globalAnnotationEditor().showWidget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBarBackend::showZoomMenu(int x, int y)
|
void ToolBarBackend::showZoomMenu(int x, int y)
|
||||||
@@ -415,6 +409,17 @@ bool ToolBarBackend::isInEditMode() const
|
|||||||
return Core::ModeManager::currentModeId() == Core::Constants::MODE_EDIT;
|
return Core::ModeManager::currentModeId() == Core::Constants::MODE_EDIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolBarBackend::launchGlobalAnnotations()
|
||||||
|
{
|
||||||
|
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_EDIT_GLOBAL_ANNOTATION);
|
||||||
|
ModelNode node = currentDesignDocument()->rewriterView()->rootModelNode();
|
||||||
|
|
||||||
|
if (node.isValid()) {
|
||||||
|
designModeWidget()->globalAnnotationEditor().setModelNode(node);
|
||||||
|
designModeWidget()->globalAnnotationEditor().showWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ToolBarBackend::isDesignModeEnabled() const
|
bool ToolBarBackend::isDesignModeEnabled() const
|
||||||
{
|
{
|
||||||
if (Core::DesignMode::instance())
|
if (Core::DesignMode::instance())
|
||||||
|
@@ -129,6 +129,8 @@ public:
|
|||||||
|
|
||||||
bool isInEditMode() const;
|
bool isInEditMode() const;
|
||||||
|
|
||||||
|
static void launchGlobalAnnotations();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void navigationHistoryChanged();
|
void navigationHistoryChanged();
|
||||||
void openDocumentsChanged();
|
void openDocumentsChanged();
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <designersettings.h>
|
#include <designersettings.h>
|
||||||
|
|
||||||
|
#include <toolbarbackend.h>
|
||||||
|
|
||||||
#include <viewmanager.h>
|
#include <viewmanager.h>
|
||||||
#include <designeractionmanagerview.h>
|
#include <designeractionmanagerview.h>
|
||||||
#include <componentcore_constants.h>
|
#include <componentcore_constants.h>
|
||||||
@@ -107,6 +109,13 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
|
|||||||
QmlDesignerPlugin::instance()->viewManager().exportAsImage();
|
QmlDesignerPlugin::instance()->viewManager().exportAsImage();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QAction *action = new QAction(tr("Edit Global Annotations..."), this);
|
||||||
|
command = Core::ActionManager::registerAction(action, "Edit.Annotations", qmlDesignerMainContext);
|
||||||
|
Core::ActionManager::actionContainer(Core::Constants::M_EDIT)
|
||||||
|
->addAction(command, Core::Constants::G_EDIT_OTHER);
|
||||||
|
|
||||||
|
connect(action, &QAction::triggered, this, [] { ToolBarBackend::launchGlobalAnnotations(); });
|
||||||
|
|
||||||
Core::ActionContainer *exportMenu = Core::ActionManager::actionContainer(
|
Core::ActionContainer *exportMenu = Core::ActionManager::actionContainer(
|
||||||
QmlProjectManager::Constants::EXPORT_MENU);
|
QmlProjectManager::Constants::EXPORT_MENU);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user