Menu item to reset all dock widgets' settings

This commit is contained in:
Klaus Basan
2020-02-10 00:01:26 +01:00
committed by Mat Sutcliffe
parent 1d5bbb6747
commit 7efebad51a
2 changed files with 15 additions and 1 deletions

View File

@@ -92,8 +92,10 @@ namespace BlackGui
bool hasDockedWidgets = this->countDockedWidgetInfoAreas() > 0; bool hasDockedWidgets = this->countDockedWidgetInfoAreas() > 0;
if (hasDockedWidgets) if (hasDockedWidgets)
{ {
menu->addAction(CIcons::dockTop16(), "Dock all", this, &CInfoArea::dockAllWidgets); menu->addAction(CIcons::dockTop16(), "Dock all", this, &CInfoArea::dockAllWidgets);
menu->addAction(CIcons::floatAll16(), "Float all", this, &CInfoArea::floatAllWidgets); menu->addAction(CIcons::floatAll16(), "Float all", this, &CInfoArea::floatAllWidgets);
menu->addAction(CIcons::refresh16(), "Reset all to defaults", this, &CInfoArea::resetAllWidgetSettings);
menu->addAction(CIcons::floatOne16(), QStringLiteral("Dock / float '%1'").arg(this->windowTitle()), this, &CInfoArea::toggleFloatingWholeInfoArea); menu->addAction(CIcons::floatOne16(), QStringLiteral("Dock / float '%1'").arg(this->windowTitle()), this, &CInfoArea::toggleFloatingWholeInfoArea);
QAction *lockTabBarMenuAction = new QAction(menu); QAction *lockTabBarMenuAction = new QAction(menu);
lockTabBarMenuAction->setObjectName(this->objectName().append("LockTabBar")); lockTabBarMenuAction->setObjectName(this->objectName().append("LockTabBar"));
@@ -352,6 +354,15 @@ namespace BlackGui
} }
} }
void CInfoArea::resetAllWidgetSettings()
{
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
{
if (!dw->isFloating()) { continue; }
dw->resetSettings();
}
}
void CInfoArea::allFloatingOnTop() void CInfoArea::allFloatingOnTop()
{ {
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas)) for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))

View File

@@ -104,6 +104,9 @@ namespace BlackGui
//! All floating info areas on top //! All floating info areas on top
void allFloatingOnTop(); void allFloatingOnTop();
//! Reset all widgets
void resetAllWidgetSettings();
//! Toggle dock / floating of the whole info area //! Toggle dock / floating of the whole info area
virtual void toggleFloatingWholeInfoArea(); virtual void toggleFloatingWholeInfoArea();