Commit 1541fbd2 authored by hjk's avatar hjk

FancyMainWindow: Use auto-hiding dock title bars

Instead of the manual hard-to-discover "Locked" action

Change-Id: I08e3b65d3e620adfa1439a8de6e028ecfbdec16d
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 08f12e95
This diff is collapsed.
......@@ -40,7 +40,7 @@ QT_END_NAMESPACE
namespace Utils {
struct FancyMainWindowPrivate;
class FancyMainWindowPrivate;
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow
{
......@@ -56,7 +56,6 @@ public:
QList<QDockWidget *> dockWidgets() const;
void setTrackingEnabled(bool enabled);
bool isLocked() const;
void saveSettings(QSettings *settings) const;
void restoreSettings(const QSettings *settings);
......@@ -64,15 +63,12 @@ public:
void restoreSettings(const QHash<QString, QVariant> &settings);
// Additional context menu actions
QAction *menuSeparator1() const;
QAction *toggleLockedAction() const;
QAction *menuSeparator2() const;
QAction *menuSeparator() const;
QAction *resetLayoutAction() const;
// Overwritten to add locked/reset.
virtual QMenu *createPopupMenu();
QDockWidget *toolBarDockWidget() const;
void setToolBarDockWidget(QDockWidget *dock);
......@@ -82,20 +78,18 @@ signals:
void resetLayout();
public slots:
void setLocked(bool locked);
void setDockActionsVisible(bool v);
protected:
void hideEvent(QHideEvent *event);
void showEvent(QShowEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
private slots:
void onDockActionTriggered();
void onDockVisibilityChange(bool);
void onTopLevelChanged();
private:
void updateDockWidget(QDockWidget *dockWidget);
void handleVisibilityChanged(bool visible);
FancyMainWindowPrivate *d;
......
......@@ -290,18 +290,10 @@ void AnalyzerManagerPrivate::delayedInit()
// Populate Windows->Views menu with standard actions.
Context analyzerContext(C_ANALYZEMODE);
ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Id(M_WINDOW_VIEWS));
Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator1(),
Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator(),
"Analyzer.Views.Separator1", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(m_mainWindow->toggleLockedAction(),
"Analyzer.Views.ToggleLocked", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator2(),
"Analyzer.Views.Separator2", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(m_mainWindow->resetLayoutAction(),
"Analyzer.Views.ResetSimple", analyzerContext);
cmd->setAttribute(Command::CA_Hide);
......
......@@ -313,16 +313,8 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->menuSeparator1(),
"Debugger.Views.Separator1", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->toggleLockedAction(),
"Debugger.Views.ToggleLocked", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->menuSeparator2(),
"Debugger.Views.Separator2", debugcontext);
cmd = Core::ActionManager::registerAction(q->menuSeparator(),
"Debugger.Views.Separator", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->resetLayoutAction(),
......@@ -464,8 +456,6 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
setDockNestingEnabled(true);
connect(this, SIGNAL(resetLayout()),
d, SLOT(resetDebuggerLayout()));
connect(toggleLockedAction(), SIGNAL(triggered()),
d, SLOT(updateDockWidgetSettings()));
QBoxLayout *editorHolderLayout = new QVBoxLayout;
editorHolderLayout->setMargin(0);
......
......@@ -2626,7 +2626,6 @@ void DebuggerPluginPrivate::createNewDock(QWidget *widget)
{
QDockWidget *dockWidget =
m_mainWindow->createDockWidget(CppLanguage, widget);
dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
dockWidget->show();
}
......
......@@ -230,14 +230,8 @@ void FormEditorW::setupViewActions()
addDockViewAction(viewMenu, ActionEditorSubWindow, m_contexts,
tr("Action Editor"), "FormEditor.ActionEditor");
// Lock/Reset
Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), m_contexts, "FormEditor.SeparatorLock", viewMenu);
cmd->setAttribute(Command::CA_Hide);
cmd = addToolAction(m_editorWidget->toggleLockedAction(), m_contexts, "FormEditor.Locked", viewMenu);
cmd->setAttribute(Command::CA_Hide);
cmd = addToolAction(m_editorWidget->menuSeparator2(), m_contexts, "FormEditor.SeparatorReset", viewMenu);
// Reset
Command *cmd = addToolAction(m_editorWidget->menuSeparator(), m_contexts, "FormEditor.SeparatorReset", viewMenu);
cmd->setAttribute(Command::CA_Hide);
cmd = addToolAction(m_editorWidget->resetLayoutAction(), m_contexts, "FormEditor.ResetToDefaultLayout", viewMenu);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment