Minor dock widget related tweaks

This commit is contained in:
Klaus Basan
2019-04-04 00:45:21 +02:00
committed by Mat Sutcliffe
parent a85ff063aa
commit 28d9e98e38
3 changed files with 15 additions and 13 deletions

View File

@@ -382,7 +382,7 @@ namespace BlackGui
}
// State actions (windows state)
contextMenu->addAction(CIcons::load16(), "Restore", this, &CDockWidget::restoreFromSettings);
contextMenu->addAction(CIcons::load16(), "Restore from settings", this, &CDockWidget::restoreFromSettings);
contextMenu->addAction(CIcons::save16(), "Save state", this, &CDockWidget::saveCurrentStateToSettings);
contextMenu->addAction(CIcons::refresh16(), "Reset to defaults", this, &CDockWidget::resetSettings);
contextMenu->addAction(CIcons::refresh16(), "Reset position", this, &CDockWidget::resetPosition);

View File

@@ -401,7 +401,6 @@ namespace BlackGui
}
if (m_saveMainWidgetState && !this->isSet(m_cmdWindowSizeReset))
{
const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers();
const bool shiftAlt = km.testFlag(Qt::ShiftModifier) && km.testFlag(Qt::AltModifier);
if (!shiftAlt) { this->restoreWindowGeometryAndState(); }

View File

@@ -99,7 +99,7 @@ namespace BlackGui
menu->addSeparator();
QMenu *subMenuToggleFloat = new QMenu("Toggle Float/Dock", menu);
QMenu *subMenuDisplay = new QMenu("Display", menu);
QMenu *subMenuRestore = new QMenu("Restore", menu);
QMenu *subMenuRestore = new QMenu("Restore from settings", menu);
QMenu *subMenuResetPositions = new QMenu("Reset position", menu);
subMenuRestore->setIcon(CIcons::load16());
subMenuResetPositions->setIcon(CIcons::refresh16());
@@ -404,8 +404,9 @@ namespace BlackGui
{
const QObject *sender = QObject::sender();
const QAction *action = qobject_cast<const QAction *>(sender);
Q_ASSERT(action);
int index = action->data().toInt();
BLACK_VERIFY(action);
if (!action) { return; }
const int index = action->data().toInt();
this->selectArea(index);
}
@@ -413,8 +414,9 @@ namespace BlackGui
{
const QObject *sender = QObject::sender();
const QAction *action = qobject_cast<const QAction *>(sender);
Q_ASSERT(action);
int index = action->data().toInt();
BLACK_VERIFY(action);
if (!action) { return; }
const int index = action->data().toInt();
this->resetPosition(index);
}
@@ -422,18 +424,19 @@ namespace BlackGui
{
const QObject *sender = QObject::sender();
const QAction *action = qobject_cast<const QAction *>(sender);
Q_ASSERT(action);
int index = action->data().toInt();
BLACK_VERIFY(action);
if (!action) { return; }
const int index = action->data().toInt();
this->toggleFloatingByIndex(index);
}
void CInfoArea::restoreDockWidgetInfoArea()
{
const QObject *sender = QObject::sender();
Q_ASSERT(sender);
const QAction *action = qobject_cast<const QAction *>(sender);
Q_ASSERT(action);
int index = action->data().toInt();
BLACK_VERIFY(action);
if (!action) { return; }
const int index = action->data().toInt();
this->restoreDockWidgetInfoAreaByIndex(index);
}
@@ -442,7 +445,7 @@ namespace BlackGui
if (!this->isValidAreaIndex(areaIndex)) { return; }
CDockWidgetInfoArea *dw = m_dockWidgetInfoAreas.at(areaIndex);
Q_ASSERT(dw);
if (!dw) return;
if (!dw) { return; }
dw->restoreFromSettings();
}