forked from qt-creator/qt-creator
QmlDesigner: Hide ADS for lite designer
* Adapt top toolbar by removing lock button and workspace combo box both in toolbar and flyout * Add lite mode bool to dockamanager in order to lock workspace by default and skip config parameter * Add new flag to ADS to block context menu on DockWidgetTab * Hide workspace menu in view menu * Deactivate middle mouse button and close button on DockWidgetTab Task-number: QDS-13169 Change-Id: I3158c9d7eaef1a58520dc466e85a859e074d1c9e Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Henning Gründl
parent
ea5a5b7f1c
commit
7b0b0deb84
@@ -282,7 +282,7 @@ Rectangle {
|
|||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: enterComponent
|
id: enterComponent
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: lockWorkspace.left
|
anchors.right: backend.isLiteModeEnabled ? shareButton.left : lockWorkspace.left
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
enabled: goIntoComponentBackend.available
|
enabled: goIntoComponentBackend.available
|
||||||
tooltip: goIntoComponentBackend.tooltip
|
tooltip: goIntoComponentBackend.tooltip
|
||||||
@@ -305,7 +305,7 @@ Rectangle {
|
|||||||
tooltip: qsTr("Sets the visible <b>Views</b> to immovable across the Workspaces.")
|
tooltip: qsTr("Sets the visible <b>Views</b> to immovable across the Workspaces.")
|
||||||
buttonIcon: backend.lockWorkspace ? StudioTheme.Constants.lockOn
|
buttonIcon: backend.lockWorkspace ? StudioTheme.Constants.lockOn
|
||||||
: StudioTheme.Constants.lockOff
|
: StudioTheme.Constants.lockOff
|
||||||
visible: !root.flyoutEnabled
|
visible: !root.flyoutEnabled && !backend.isLiteModeEnabled
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: backend.lockWorkspace
|
checked: backend.lockWorkspace
|
||||||
checkedInverted: true
|
checkedInverted: true
|
||||||
@@ -318,9 +318,9 @@ Rectangle {
|
|||||||
style: StudioTheme.Values.toolbarStyle
|
style: StudioTheme.Values.toolbarStyle
|
||||||
width: 210
|
width: 210
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: annotations.left
|
anchors.right: shareButton.left
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
visible: !root.flyoutEnabled
|
visible: !root.flyoutEnabled && !backend.isLiteModeEnabled
|
||||||
model: WorkspaceModel { id: workspaceModel }
|
model: WorkspaceModel { id: workspaceModel }
|
||||||
textRole: "displayName"
|
textRole: "displayName"
|
||||||
valueRole: "fileName"
|
valueRole: "fileName"
|
||||||
@@ -333,20 +333,6 @@ Rectangle {
|
|||||||
onCountChanged: workspaces.currentIndex = workspaces.indexOfValue(backend.currentWorkspace)
|
onCountChanged: workspaces.currentIndex = workspaces.indexOfValue(backend.currentWorkspace)
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolbarButton {
|
|
||||||
id: annotations
|
|
||||||
visible: false
|
|
||||||
enabled: backend.isInDesignMode
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: shareButton.left
|
|
||||||
anchors.rightMargin: 10
|
|
||||||
width: 0
|
|
||||||
tooltip: qsTr("Edit Annotations")
|
|
||||||
buttonIcon: StudioTheme.Constants.annotations_large
|
|
||||||
|
|
||||||
onClicked: backend.editGlobalAnnoation()
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: shareButton
|
id: shareButton
|
||||||
style: StudioTheme.Values.primaryToolbarStyle
|
style: StudioTheme.Values.primaryToolbarStyle
|
||||||
@@ -394,7 +380,8 @@ Rectangle {
|
|||||||
readonly property int padding: 6
|
readonly property int padding: 6
|
||||||
|
|
||||||
width: row.width + window.padding * 2
|
width: row.width + window.padding * 2
|
||||||
height: row.height + workspacesFlyout.height + 3 * window.padding
|
height: row.height + (backend.isLiteModeEnabled ? 0 : workspacesFlyout.height)
|
||||||
|
+ (backend.isLiteModeEnabled ? 2 : 3) * window.padding
|
||||||
+ (workspacesFlyout.popup.opened ? workspacesFlyout.popup.height : 0)
|
+ (workspacesFlyout.popup.opened ? workspacesFlyout.popup.height : 0)
|
||||||
visible: false
|
visible: false
|
||||||
flags: Qt.FramelessWindowHint | Qt.Dialog | Qt.NoDropShadowWindowHint
|
flags: Qt.FramelessWindowHint | Qt.Dialog | Qt.NoDropShadowWindowHint
|
||||||
@@ -470,6 +457,7 @@ Rectangle {
|
|||||||
: StudioTheme.Constants.lockOff
|
: StudioTheme.Constants.lockOff
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: backend.lockWorkspace
|
checked: backend.lockWorkspace
|
||||||
|
visible: !backend.isLiteModeEnabled
|
||||||
|
|
||||||
onClicked: backend.setLockWorkspace(lockWorkspaceFlyout.checked)
|
onClicked: backend.setLockWorkspace(lockWorkspaceFlyout.checked)
|
||||||
}
|
}
|
||||||
@@ -498,6 +486,7 @@ Rectangle {
|
|||||||
textRole: "displayName"
|
textRole: "displayName"
|
||||||
valueRole: "fileName"
|
valueRole: "fileName"
|
||||||
currentIndex: workspacesFlyout.indexOfValue(backend.currentWorkspace)
|
currentIndex: workspacesFlyout.indexOfValue(backend.currentWorkspace)
|
||||||
|
visible: !backend.isLiteModeEnabled
|
||||||
|
|
||||||
onCompressedActivated: backend.setCurrentWorkspace(workspacesFlyout.currentValue)
|
onCompressedActivated: backend.setCurrentWorkspace(workspacesFlyout.currentValue)
|
||||||
onCountChanged: workspacesFlyout.currentIndex = workspacesFlyout.indexOfValue(backend.currentWorkspace)
|
onCountChanged: workspacesFlyout.currentIndex = workspacesFlyout.indexOfValue(backend.currentWorkspace)
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ public:
|
|||||||
bool m_wasShown = false;
|
bool m_wasShown = false;
|
||||||
bool m_workspaceOrderDirty = false;
|
bool m_workspaceOrderDirty = false;
|
||||||
|
|
||||||
|
bool m_mcusProject = false;
|
||||||
|
bool m_liteModeEnabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
*/
|
*/
|
||||||
@@ -498,7 +501,10 @@ void DockManager::initialize()
|
|||||||
|
|
||||||
openWorkspace(workspace);
|
openWorkspace(workspace);
|
||||||
|
|
||||||
lockWorkspace(d->m_settings->value(Constants::LOCK_WORKSPACE_SETTINGS_KEY, false).toBool());
|
if (d->m_liteModeEnabled)
|
||||||
|
lockWorkspace(true);
|
||||||
|
else
|
||||||
|
lockWorkspace(d->m_settings->value(Constants::LOCK_WORKSPACE_SETTINGS_KEY, false).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area,
|
DockAreaWidget *DockManager::addDockWidget(DockWidgetArea area,
|
||||||
@@ -1749,11 +1755,21 @@ void DockManager::saveLockWorkspace()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DockManager::setMcusProject(bool value) {
|
void DockManager::setMcusProject(bool value) {
|
||||||
m_mcusProject = value;
|
d->m_mcusProject = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockManager::mcusProject() const {
|
bool DockManager::mcusProject() const {
|
||||||
return m_mcusProject;
|
return d->m_mcusProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DockManager::setLiteMode(bool value)
|
||||||
|
{
|
||||||
|
d->m_liteModeEnabled = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DockManager::isLiteModeEnabled() const
|
||||||
|
{
|
||||||
|
return d->m_liteModeEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ADS
|
} // namespace ADS
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
= 0x2000, ///< If this option is enabled, the tab of a dock widget is always displayed - even if it is the only visible dock widget in a floating widget.
|
= 0x2000, ///< If this option is enabled, the tab of a dock widget is always displayed - even if it is the only visible dock widget in a floating widget.
|
||||||
DockAreaHasUndockButton = 0x4000, //!< If the flag is set each dock area has an undock button
|
DockAreaHasUndockButton = 0x4000, //!< If the flag is set each dock area has an undock button
|
||||||
DockAreaHasTabsMenuButton
|
DockAreaHasTabsMenuButton
|
||||||
= 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
= 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
||||||
DockAreaHideDisabledButtons
|
DockAreaHideDisabledButtons
|
||||||
= 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the toolbar at all (enabling them will bring them back)
|
= 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the toolbar at all (enabling them will bring them back)
|
||||||
DockAreaDynamicTabsMenuButtonVisibility
|
DockAreaDynamicTabsMenuButtonVisibility
|
||||||
@@ -144,6 +144,8 @@ public:
|
|||||||
EqualSplitOnInsertion
|
EqualSplitOnInsertion
|
||||||
= 0x400000, ///!< if enabled, the space is equally distributed to all widgets in a splitter
|
= 0x400000, ///!< if enabled, the space is equally distributed to all widgets in a splitter
|
||||||
|
|
||||||
|
HideContextMenuDockWidgetTab = 0x800000,
|
||||||
|
|
||||||
MiddleMouseButtonClosesTab
|
MiddleMouseButtonClosesTab
|
||||||
= 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse
|
= 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse
|
||||||
|
|
||||||
@@ -182,15 +184,15 @@ public:
|
|||||||
AutoHideButtonCheckable
|
AutoHideButtonCheckable
|
||||||
= 0x08, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes.
|
= 0x08, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes.
|
||||||
AutoHideSideBarsIconOnly
|
AutoHideSideBarsIconOnly
|
||||||
= 0x10, ///< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown
|
= 0x10, //!< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown
|
||||||
AutoHideShowOnMouseOver
|
AutoHideShowOnMouseOver
|
||||||
= 0x20, ///< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container
|
= 0x20, //!< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container
|
||||||
AutoHideCloseButtonCollapsesDock
|
AutoHideCloseButtonCollapsesDock
|
||||||
= 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely
|
= 0x40, //!< Close button of an auto hide container collapses the dock instead of hiding it completely
|
||||||
AutoHideHasCloseButton
|
AutoHideHasCloseButton
|
||||||
= 0x80, //< If the flag is set an auto hide title bar has a close button
|
= 0x80, //!< If the flag is set an auto hide title bar has a close button
|
||||||
AutoHideHasMinimizeButton
|
AutoHideHasMinimizeButton
|
||||||
= 0x100, ///< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget
|
= 0x100, //!< if this flag is set, the auto hide title bar has a minimize button to collapse the dock widget
|
||||||
|
|
||||||
DefaultAutoHideConfig = AutoHideFeatureEnabled | DockAreaHasAutoHideButton
|
DefaultAutoHideConfig = AutoHideFeatureEnabled | DockAreaHasAutoHideButton
|
||||||
| AutoHideCloseButtonCollapsesDock | AutoHideHasCloseButton
|
| AutoHideCloseButtonCollapsesDock | AutoHideHasCloseButton
|
||||||
@@ -774,6 +776,9 @@ public:
|
|||||||
void setMcusProject(bool value);
|
void setMcusProject(bool value);
|
||||||
bool mcusProject() const;
|
bool mcusProject() const;
|
||||||
|
|
||||||
|
void setLiteMode(bool value);
|
||||||
|
bool isLiteModeEnabled() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void aboutToUnloadWorkspace(QString fileName);
|
void aboutToUnloadWorkspace(QString fileName);
|
||||||
void aboutToLoadWorkspace(QString fileName);
|
void aboutToLoadWorkspace(QString fileName);
|
||||||
@@ -795,8 +800,6 @@ private:
|
|||||||
|
|
||||||
void saveStartupWorkspace();
|
void saveStartupWorkspace();
|
||||||
void saveLockWorkspace();
|
void saveLockWorkspace();
|
||||||
|
|
||||||
bool m_mcusProject = false;
|
|
||||||
}; // class DockManager
|
}; // class DockManager
|
||||||
|
|
||||||
} // namespace ADS
|
} // namespace ADS
|
||||||
|
|||||||
@@ -461,6 +461,9 @@ void DockWidgetTab::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
void DockWidgetTab::contextMenuEvent(QContextMenuEvent *event)
|
void DockWidgetTab::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
|
if (DockManager::testConfigFlag(DockManager::HideContextMenuDockWidgetTab))
|
||||||
|
return;
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
if (d->isDraggingState(DraggingFloatingWidget))
|
if (d->isDraggingState(DraggingFloatingWidget))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -763,6 +763,11 @@ bool ToolBarBackend::isDocumentDirty() const
|
|||||||
&& Core::EditorManager::currentDocument()->isModified();
|
&& Core::EditorManager::currentDocument()->isModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ToolBarBackend::isLiteModeEnabled() const
|
||||||
|
{
|
||||||
|
return QmlDesignerBasePlugin::isLiteModeEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
void ToolBarBackend::launchGlobalAnnotations()
|
void ToolBarBackend::launchGlobalAnnotations()
|
||||||
{
|
{
|
||||||
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_EDIT_GLOBAL_ANNOTATION);
|
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_TOOLBAR_EDIT_GLOBAL_ANNOTATION);
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ class ToolBarBackend : public QObject
|
|||||||
Q_PROPERTY(bool isSharingEnabled READ isSharingEnabled NOTIFY isSharingEnabledChanged)
|
Q_PROPERTY(bool isSharingEnabled READ isSharingEnabled NOTIFY isSharingEnabledChanged)
|
||||||
Q_PROPERTY(bool isDocumentDirty READ isDocumentDirty NOTIFY isDocumentDirtyChanged)
|
Q_PROPERTY(bool isDocumentDirty READ isDocumentDirty NOTIFY isDocumentDirtyChanged)
|
||||||
|
|
||||||
|
Q_PROPERTY(bool isLiteModeEnabled READ isLiteModeEnabled CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ToolBarBackend(QObject *parent = nullptr);
|
ToolBarBackend(QObject *parent = nullptr);
|
||||||
static void registerDeclarativeType();
|
static void registerDeclarativeType();
|
||||||
@@ -150,6 +152,8 @@ public:
|
|||||||
|
|
||||||
bool isDocumentDirty() const;
|
bool isDocumentDirty() const;
|
||||||
|
|
||||||
|
bool isLiteModeEnabled() const;
|
||||||
|
|
||||||
static void launchGlobalAnnotations();
|
static void launchGlobalAnnotations();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -205,14 +205,20 @@ void DesignModeWidget::setup()
|
|||||||
ADS::DockManager::setConfigFlag(ADS::DockManager::OpaqueSplitterResize, true);
|
ADS::DockManager::setConfigFlag(ADS::DockManager::OpaqueSplitterResize, true);
|
||||||
ADS::DockManager::setConfigFlag(ADS::DockManager::AllTabsHaveCloseButton, false);
|
ADS::DockManager::setConfigFlag(ADS::DockManager::AllTabsHaveCloseButton, false);
|
||||||
ADS::DockManager::setConfigFlag(ADS::DockManager::RetainTabSizeWhenCloseButtonHidden, true);
|
ADS::DockManager::setConfigFlag(ADS::DockManager::RetainTabSizeWhenCloseButtonHidden, true);
|
||||||
|
|
||||||
//ADS::DockManager::setAutoHideConfigFlags(ADS::DockManager::DefaultAutoHideConfig);
|
//ADS::DockManager::setAutoHideConfigFlags(ADS::DockManager::DefaultAutoHideConfig);
|
||||||
|
|
||||||
|
if (QmlDesignerBasePlugin::isLiteModeEnabled()) {
|
||||||
|
ADS::DockManager::setConfigFlag(ADS::DockManager::ActiveTabHasCloseButton, false);
|
||||||
|
ADS::DockManager::setConfigFlag(ADS::DockManager::MiddleMouseButtonClosesTab, false);
|
||||||
|
ADS::DockManager::setConfigFlag(ADS::DockManager::HideContextMenuDockWidgetTab, true);
|
||||||
|
}
|
||||||
|
|
||||||
auto designerSettings = DesignerSettings(settings);
|
auto designerSettings = DesignerSettings(settings);
|
||||||
if (designerSettings.value(DesignerSettingsKey::ENABLE_DOCKWIDGET_CONTENT_MIN_SIZE).toBool())
|
if (designerSettings.value(DesignerSettingsKey::ENABLE_DOCKWIDGET_CONTENT_MIN_SIZE).toBool())
|
||||||
m_minimumSizeHintMode = ADS::DockWidget::MinimumSizeHintFromContentMinimumSize;
|
m_minimumSizeHintMode = ADS::DockWidget::MinimumSizeHintFromContentMinimumSize;
|
||||||
|
|
||||||
m_dockManager = new ADS::DockManager(this);
|
m_dockManager = new ADS::DockManager(this);
|
||||||
|
m_dockManager->setLiteMode(QmlDesignerBasePlugin::isLiteModeEnabled());
|
||||||
m_dockManager->setSettings(settings);
|
m_dockManager->setSettings(settings);
|
||||||
m_dockManager->setWorkspacePresetsPath(
|
m_dockManager->setWorkspacePresetsPath(
|
||||||
Core::ICore::resourcePath("qmldesigner/workspacePresets/").toString());
|
Core::ICore::resourcePath("qmldesigner/workspacePresets/").toString());
|
||||||
@@ -277,35 +283,6 @@ void DesignModeWidget::setup()
|
|||||||
ADS::DockManager::iconProvider().registerCustomIcon(ADS::FloatingWidgetNormalIcon,
|
ADS::DockManager::iconProvider().registerCustomIcon(ADS::FloatingWidgetNormalIcon,
|
||||||
floatingWidgetNormalIcon);
|
floatingWidgetNormalIcon);
|
||||||
|
|
||||||
// Setup Actions and Menus
|
|
||||||
Core::ActionContainer *mview = Core::ActionManager::actionContainer(Core::Constants::M_VIEW);
|
|
||||||
// View > Views
|
|
||||||
Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_VIEW_VIEWS);
|
|
||||||
connect(mviews->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowViews);
|
|
||||||
mviews->menu()->addSeparator();
|
|
||||||
// View > Workspaces
|
|
||||||
Core::ActionContainer *mworkspaces = Core::ActionManager::createMenu(QmlDesigner::Constants::M_VIEW_WORKSPACES);
|
|
||||||
mview->addMenu(mworkspaces, Core::Constants::G_VIEW_VIEWS);
|
|
||||||
mworkspaces->menu()->setTitle(tr("&Workspaces"));
|
|
||||||
mworkspaces->setOnAllDisabledBehavior(Core::ActionContainer::Show);
|
|
||||||
// Connect opening of the 'workspaces' menu with creation of the workspaces menu
|
|
||||||
connect(mworkspaces->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowWorkspaces);
|
|
||||||
|
|
||||||
// Initially disable menus
|
|
||||||
mworkspaces->menu()->setEnabled(false);
|
|
||||||
|
|
||||||
// Enable/disable menus when mode is different to MODE_DESIGN
|
|
||||||
connect(Core::ModeManager::instance(),
|
|
||||||
&Core::ModeManager::currentModeChanged,
|
|
||||||
this,
|
|
||||||
[mworkspaces](Utils::Id mode, Utils::Id) {
|
|
||||||
if (mode == Core::Constants::MODE_DESIGN) {
|
|
||||||
mworkspaces->menu()->setEnabled(true);
|
|
||||||
} else {
|
|
||||||
mworkspaces->menu()->setEnabled(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a DockWidget for each QWidget and add them to the DockManager
|
// Create a DockWidget for each QWidget and add them to the DockManager
|
||||||
const Core::Context designContext(Core::Constants::C_DESIGN_MODE);
|
const Core::Context designContext(Core::Constants::C_DESIGN_MODE);
|
||||||
static const Utils::Id actionToggle("QmlDesigner.Toggle");
|
static const Utils::Id actionToggle("QmlDesigner.Toggle");
|
||||||
@@ -403,8 +380,40 @@ void DesignModeWidget::setup()
|
|||||||
return first->description() < second->description();
|
return first->description() < second->description();
|
||||||
});
|
});
|
||||||
|
|
||||||
for (Core::Command *command : viewCommands)
|
if (!QmlDesignerBasePlugin::isLiteModeEnabled()) {
|
||||||
mviews->addAction(command);
|
// Setup Actions and Menus
|
||||||
|
Core::ActionContainer *mview = Core::ActionManager::actionContainer(Core::Constants::M_VIEW);
|
||||||
|
// View > Views
|
||||||
|
Core::ActionContainer *mviews = Core::ActionManager::createMenu(Core::Constants::M_VIEW_VIEWS);
|
||||||
|
connect(mviews->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowViews);
|
||||||
|
mviews->menu()->addSeparator();
|
||||||
|
// View > Workspaces
|
||||||
|
Core::ActionContainer *mworkspaces = Core::ActionManager::createMenu(
|
||||||
|
QmlDesigner::Constants::M_VIEW_WORKSPACES);
|
||||||
|
mview->addMenu(mworkspaces, Core::Constants::G_VIEW_VIEWS);
|
||||||
|
mworkspaces->menu()->setTitle(tr("&Workspaces"));
|
||||||
|
mworkspaces->setOnAllDisabledBehavior(Core::ActionContainer::Show);
|
||||||
|
// Connect opening of the 'workspaces' menu with creation of the workspaces menu
|
||||||
|
connect(mworkspaces->menu(), &QMenu::aboutToShow, this, &DesignModeWidget::aboutToShowWorkspaces);
|
||||||
|
|
||||||
|
// Initially disable menus
|
||||||
|
mworkspaces->menu()->setEnabled(false);
|
||||||
|
|
||||||
|
// Enable/disable menus when mode is different to MODE_DESIGN
|
||||||
|
connect(Core::ModeManager::instance(),
|
||||||
|
&Core::ModeManager::currentModeChanged,
|
||||||
|
this,
|
||||||
|
[mworkspaces](Utils::Id mode, Utils::Id) {
|
||||||
|
if (mode == Core::Constants::MODE_DESIGN) {
|
||||||
|
mworkspaces->menu()->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
mworkspaces->menu()->setEnabled(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (Core::Command *command : viewCommands)
|
||||||
|
mviews->addAction(command);
|
||||||
|
}
|
||||||
|
|
||||||
// Create toolbars
|
// Create toolbars
|
||||||
if (!ToolBar::isVisible()) {
|
if (!ToolBar::isVisible()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user