mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4283 Improve window tiling during resize
This commit is contained in:
@@ -65,7 +65,7 @@ RiuPlotMainWindow::RiuPlotMainWindow()
|
||||
, m_windowMenu(nullptr)
|
||||
, m_blockSlotSubWindowActivated(false)
|
||||
{
|
||||
m_mdiArea = new QMdiArea;
|
||||
m_mdiArea = new RiuMdiArea;
|
||||
connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), SLOT(slotSubWindowActivated(QMdiSubWindow*)));
|
||||
setCentralWidget(m_mdiArea);
|
||||
|
||||
@@ -120,6 +120,11 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded()
|
||||
}
|
||||
}
|
||||
|
||||
if (subWindowsAreTiled())
|
||||
{
|
||||
tileSubWindows();
|
||||
}
|
||||
|
||||
if (m_activePlotViewWindow && m_activePlotViewWindow->viewWidget())
|
||||
{
|
||||
if (m_activePlotViewWindow->mdiWindowGeometry().isMaximized)
|
||||
@@ -369,6 +374,7 @@ void RiuPlotMainWindow::refreshToolbars()
|
||||
QStringList allToolbarCommandNames = toolbarCommandIds();
|
||||
|
||||
caf::CmdFeatureManager::instance()->refreshEnabledState(allToolbarCommandNames);
|
||||
caf::CmdFeatureManager::instance()->refreshCheckedState(allToolbarCommandNames);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -584,7 +590,10 @@ void RiuPlotMainWindow::removeViewer(QWidget* viewer)
|
||||
m_blockSlotSubWindowActivated = true;
|
||||
m_mdiArea->removeSubWindow(findMdiSubWindow(viewer));
|
||||
m_blockSlotSubWindowActivated = false;
|
||||
|
||||
if (subWindowsAreTiled())
|
||||
{
|
||||
tileSubWindows();
|
||||
}
|
||||
refreshToolbars();
|
||||
}
|
||||
|
||||
@@ -840,7 +849,7 @@ void RiuPlotMainWindow::customMenuRequested(const QPoint& pos)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::tileWindows()
|
||||
void RiuPlotMainWindow::tileSubWindows()
|
||||
{
|
||||
QMdiArea::WindowOrder currentActivationOrder = m_mdiArea->activationOrder();
|
||||
|
||||
@@ -871,6 +880,45 @@ void RiuPlotMainWindow::tileWindows()
|
||||
// Set back the original activation order to avoid messing with the standard ordering
|
||||
m_mdiArea->setActivationOrder(currentActivationOrder);
|
||||
m_mdiArea->setActiveSubWindow(a);
|
||||
|
||||
storeSubWindowTiling(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::storeSubWindowTiling(bool tiled)
|
||||
{
|
||||
RiaApplication::instance()->project()->setSubWindowsTiledInPlotWindow(tiled);
|
||||
refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::clearWindowTiling()
|
||||
{
|
||||
QMdiArea::WindowOrder currentActivationOrder = m_mdiArea->activationOrder();
|
||||
|
||||
std::list<QMdiSubWindow*> windowList;
|
||||
for (QMdiSubWindow* subWindow : m_mdiArea->subWindowList(currentActivationOrder))
|
||||
{
|
||||
subWindow->hide();
|
||||
subWindow->showNormal();
|
||||
}
|
||||
storeSubWindowTiling(false);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuPlotMainWindow::subWindowsAreTiled() const
|
||||
{
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
return RiaApplication::instance()->project()->subWindowsTiledPlotWindow();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user