[UI] Default sizes for dock widgets plus some smaller fixes:

* renamings
* reset all to defaults
* sizes
This commit is contained in:
Klaus Basan
2020-04-15 16:27:39 +02:00
committed by Mat Sutcliffe
parent 465c8fd81d
commit df69ef47a0
6 changed files with 27 additions and 10 deletions

View File

@@ -75,7 +75,7 @@ namespace BlackGui
if (!this->isParentDockWidgetFloating()) { return; }
// manually setting size, all other approaches failed
static const QSize defaultSizeShown(300, 400);
static const QSize defaultSizeShown(500, 600);
static const QSize defaultSizeHidden(300, 150);
// keep old size

View File

@@ -35,13 +35,14 @@ namespace BlackGui
QSize CCockpitInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const
{
// see also CMainInfoAreaComponent::getPreferredSizeWhenFloating
Q_UNUSED(areaIndex)
return QSize(600, 400);
}
const QPixmap &CCockpitInfoAreaComponent::indexToPixmap(int areaIndex) const
{
InfoArea area = static_cast<InfoArea>(areaIndex);
const InfoArea area = static_cast<InfoArea>(areaIndex);
switch (area)
{
case InfoAreaAudio: return CIcons::appAudio16();

View File

@@ -156,7 +156,6 @@ namespace BlackGui
case InfoAreaUsers:
case InfoAreaLog:
case InfoAreaSimulator:
return QSize(400, 300);
case InfoAreaMapping:
case InfoAreaInterpolation:
case InfoAreaSettings:
@@ -165,9 +164,9 @@ namespace BlackGui
case InfoAreaRadar:
return QSize(600, 400);
case InfoAreaFlightPlan:
return QSize(625, 500);
return QSize(800, 600);
default:
return QSize(400, 300);
return QSize(600, 400);
}
}

View File

@@ -133,7 +133,7 @@ namespace BlackGui
{
const bool r = widgetsWithDockWidgetInfoAreaComponent.removeOne(iac);
Q_ASSERT(r); // why is the nested component not in the child list?
Q_UNUSED(r);
Q_UNUSED(r)
}
}
return widgetsWithDockWidgetInfoAreaComponent;

View File

@@ -94,7 +94,8 @@ namespace BlackGui
{
menu->addAction(CIcons::dockTop16(), "Dock all", this, &CInfoArea::dockAllWidgets);
menu->addAction(CIcons::floatAll16(), "Float all", this, &CInfoArea::floatAllWidgets);
menu->addAction(CIcons::refresh16(), "Reset all to defaults", this, &CInfoArea::resetAllWidgetSettings);
menu->addAction(CIcons::refresh16(), "Reset all floating to defaults", this, &CInfoArea::resetAllFloatingWidgetSettings);
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);
QAction *lockTabBarMenuAction = new QAction(menu);
@@ -354,11 +355,20 @@ namespace BlackGui
}
}
void CInfoArea::resetAllFloatingWidgetSettings()
{
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
{
if (!dw || !dw->isFloating()) { continue; }
dw->resetSettings();
}
}
void CInfoArea::resetAllWidgetSettings()
{
for (CDockWidgetInfoArea *dw : as_const(m_dockWidgetInfoAreas))
{
if (!dw->isFloating()) { continue; }
if (!dw || !dw->isFloating()) { continue; }
dw->resetSettings();
}
}
@@ -573,7 +583,7 @@ namespace BlackGui
{
if (!sGui || sGui->isShuttingDown()) { return; }
this->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::East);
bool init = m_tabBar ? false : true;
const bool init = m_tabBar ? false : true;
for (int i = 0; i < m_dockWidgetInfoAreas.size(); i++)
{
@@ -605,7 +615,10 @@ namespace BlackGui
{
after->setFloating(false);
}
// we can not tabify first
if (!first) { continue; }
this->tabifyDockWidget(first, after);
}
@@ -834,6 +847,7 @@ namespace BlackGui
QPointer<CInfoArea> myself(this);
QTimer::singleShot(1000, this, [ = ]
{
if (!myself) { return; }
myself->emitInfoAreaStatus();
});
}

View File

@@ -104,7 +104,10 @@ namespace BlackGui
//! All floating info areas on top
void allFloatingOnTop();
//! Reset all widgets
//! Reset all floating widget settings
void resetAllFloatingWidgetSettings();
//! Reset all widget settings
void resetAllWidgetSettings();
//! Toggle dock / floating of the whole info area