forked from qt-creator/qt-creator
FancyMainWindow: Move toolbarDockWidget "property" to subclass
This was only used to accommodate the debugger main window and is not needed in the base class. Change-Id: Ifbe9937cd4c21f5bed2fab35b23d874f4f2dd0e4 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -61,7 +61,6 @@ struct FancyMainWindowPrivate
|
||||
QAction m_menuSeparator1;
|
||||
QAction m_menuSeparator2;
|
||||
QAction m_resetLayoutAction;
|
||||
QDockWidget *m_toolBarDockWidget;
|
||||
QAction m_autoHideTitleBars;
|
||||
};
|
||||
|
||||
@@ -336,7 +335,6 @@ FancyMainWindowPrivate::FancyMainWindowPrivate(FancyMainWindow *parent) :
|
||||
m_menuSeparator1(0),
|
||||
m_menuSeparator2(0),
|
||||
m_resetLayoutAction(FancyMainWindow::tr("Reset to Default Layout"), 0),
|
||||
m_toolBarDockWidget(0),
|
||||
m_autoHideTitleBars(FancyMainWindow::tr("Automatically Hide View Title Bars"), 0)
|
||||
{
|
||||
m_menuSeparator1.setSeparator(true);
|
||||
@@ -552,14 +550,4 @@ void FancyMainWindow::setDockActionsVisible(bool v)
|
||||
d->m_resetLayoutAction.setVisible(v);
|
||||
}
|
||||
|
||||
QDockWidget *FancyMainWindow::toolBarDockWidget() const
|
||||
{
|
||||
return d->m_toolBarDockWidget;
|
||||
}
|
||||
|
||||
void FancyMainWindow::setToolBarDockWidget(QDockWidget *dock)
|
||||
{
|
||||
d->m_toolBarDockWidget = dock;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
@@ -65,9 +65,6 @@ public:
|
||||
QAction *resetLayoutAction() const;
|
||||
void addDockActionsToMenu(QMenu *menu);
|
||||
|
||||
QDockWidget *toolBarDockWidget() const;
|
||||
void setToolBarDockWidget(QDockWidget *dock);
|
||||
|
||||
bool autoHideTitleBars() const;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -70,16 +70,6 @@ DebuggerMainWindow::DebuggerMainWindow()
|
||||
|
||||
connect(this, &FancyMainWindow::resetLayout,
|
||||
this, &DebuggerMainWindow::resetCurrentPerspective);
|
||||
|
||||
auto dock = new QDockWidget(tr("Toolbar"));
|
||||
dock->setObjectName(QLatin1String("Toolbar"));
|
||||
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
dock->setTitleBarWidget(new QWidget(dock)); // hide title bar
|
||||
dock->setProperty("managed_dockwidget", QLatin1String("true"));
|
||||
|
||||
addDockWidget(Qt::BottomDockWidgetArea, dock);
|
||||
setToolBarDockWidget(dock);
|
||||
}
|
||||
|
||||
DebuggerMainWindow::~DebuggerMainWindow()
|
||||
@@ -163,8 +153,6 @@ void DebuggerMainWindow::finalizeSetup()
|
||||
menu.exec(viewButton->mapToGlobal(QPoint()));
|
||||
});
|
||||
|
||||
toolBarDockWidget()->setWidget(toolbar);
|
||||
|
||||
Context debugcontext(Debugger::Constants::C_DEBUGMODE);
|
||||
|
||||
ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
|
||||
@@ -186,6 +174,17 @@ void DebuggerMainWindow::finalizeSetup()
|
||||
viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
|
||||
|
||||
addDockActionsToMenu(viewsMenu->menu());
|
||||
|
||||
auto dock = new QDockWidget(tr("Toolbar"));
|
||||
dock->setObjectName(QLatin1String("Toolbar"));
|
||||
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
dock->setTitleBarWidget(new QWidget(dock)); // hide title bar
|
||||
dock->setProperty("managed_dockwidget", QLatin1String("true"));
|
||||
dock->setWidget(toolbar);
|
||||
m_toolbarDock = dock;
|
||||
|
||||
addDockWidget(Qt::BottomDockWidgetArea, dock);
|
||||
}
|
||||
|
||||
void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId, bool fromStoredSettings)
|
||||
@@ -240,7 +239,7 @@ void DebuggerMainWindow::loadPerspectiveHelper(const QByteArray &perspectiveId,
|
||||
addDockWidget(operation.area, dock);
|
||||
QDockWidget *anchor = m_dockForDockId.value(operation.anchorDockId);
|
||||
if (!anchor && operation.area == Qt::BottomDockWidgetArea)
|
||||
anchor = toolBarDockWidget();
|
||||
anchor = m_toolbarDock;
|
||||
if (anchor) {
|
||||
switch (operation.operationType) {
|
||||
case Perspective::AddToTab:
|
||||
|
||||
@@ -127,6 +127,7 @@ private:
|
||||
QComboBox *m_perspectiveChooser;
|
||||
QStackedWidget *m_controlsStackWidget;
|
||||
Utils::StatusLabel *m_statusLabel;
|
||||
QDockWidget *m_toolbarDock;
|
||||
|
||||
QHash<QByteArray, QDockWidget *> m_dockForDockId;
|
||||
QHash<QByteArray, QWidget *> m_toolbarForPerspectiveId;
|
||||
|
||||
Reference in New Issue
Block a user