mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4847 Move setFixedWindowSizeFor3dViews to RiuMainWindowTools
This commit is contained in:
parent
69ff4d25f2
commit
4bfcf86962
@ -867,8 +867,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( cvf::Progr
|
||||
|
||||
if ( snapshotHeight > -1 && snapshotWidth > -1 )
|
||||
{
|
||||
QSize windowSize( snapshotWidth, snapshotHeight );
|
||||
RiaRegressionTestRunner::setFixedWindowSizeFor3dViews( windowSize );
|
||||
RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, snapshotWidth, snapshotHeight );
|
||||
}
|
||||
|
||||
processEvents();
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainWindowTools.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@ -469,47 +470,14 @@ void RiaRegressionTestRunner::removeDirectoryWithContent( QDir& dirToDelete )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTestRunner::setFixedWindowSizeFor3dViews( const QSize& snapshotImageSize )
|
||||
void RiaRegressionTestRunner::setDefaultFixedWindowSizeFor3dViews()
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if ( !mainWnd ) return;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if ( !proj ) return;
|
||||
QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize();
|
||||
|
||||
std::vector<RimCase*> projectCases;
|
||||
proj->allCases( projectCases );
|
||||
|
||||
for ( RimCase* cas : projectCases )
|
||||
{
|
||||
if ( !cas ) continue;
|
||||
|
||||
std::vector<Rim3dView*> views = cas->views();
|
||||
|
||||
for ( Rim3dView* riv : views )
|
||||
{
|
||||
if ( riv && riv->viewer() )
|
||||
{
|
||||
// Make sure all views are maximized for snapshotting
|
||||
QMdiSubWindow* subWnd = mainWnd->findMdiSubWindow( riv->viewer()->layoutWidget() );
|
||||
if ( subWnd )
|
||||
{
|
||||
subWnd->showMaximized();
|
||||
}
|
||||
|
||||
// This size is set to match the regression test reference images
|
||||
riv->viewer()->setFixedSize( snapshotImageSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTestRunner::setDefaultFixedWindowSizeFor3dViews()
|
||||
{
|
||||
setFixedWindowSizeFor3dViews( RiaRegressionTestRunner::regressionDefaultImageSize() );
|
||||
RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -517,34 +485,12 @@ void RiaRegressionTestRunner::setDefaultFixedWindowSizeFor3dViews()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaRegressionTestRunner::resizePlotWindows()
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if ( !proj ) return;
|
||||
|
||||
RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if ( !plotMainWindow ) return;
|
||||
|
||||
std::vector<RimViewWindow*> viewWindows;
|
||||
QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize();
|
||||
|
||||
proj->mainPlotCollection()->descendantsIncludingThisOfType( viewWindows );
|
||||
|
||||
for ( auto viewWindow : viewWindows )
|
||||
{
|
||||
if ( viewWindow->isMdiWindow() )
|
||||
{
|
||||
QWidget* viewWidget = viewWindow->viewWidget();
|
||||
|
||||
if ( viewWidget )
|
||||
{
|
||||
QMdiSubWindow* mdiWindow = plotMainWindow->findMdiSubWindow( viewWidget );
|
||||
if ( mdiWindow )
|
||||
{
|
||||
mdiWindow->showNormal();
|
||||
|
||||
viewWidget->resize( RiaRegressionTestRunner::regressionDefaultImageSize() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( plotMainWindow, defaultSize.width(), defaultSize.height() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -42,7 +42,6 @@ public:
|
||||
bool useOpenMPForGeometryCreation() const;
|
||||
|
||||
static void updateRegressionTest( const QString& testRootPath );
|
||||
static void setFixedWindowSizeFor3dViews( const QSize& snapshotImageSize );
|
||||
static void setDefaultFixedWindowSizeFor3dViews();
|
||||
|
||||
private:
|
||||
|
@ -22,10 +22,15 @@
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuInterfaceToViewWindow.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMainWindowBase.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
@ -95,23 +100,60 @@ void RiuMainWindowTools::collapseSiblings( const caf::PdmUiItem* sourceUiItem )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height )
|
||||
{
|
||||
if ( mainWindow )
|
||||
if ( !mainWindow ) return;
|
||||
|
||||
auto widgets = mainWindow->findChildren<QMdiSubWindow*>();
|
||||
for ( auto w : widgets )
|
||||
{
|
||||
auto widgets = mainWindow->findChildren<QMdiSubWindow*>();
|
||||
for ( auto w : widgets )
|
||||
if ( !w ) continue;
|
||||
|
||||
w->showNormal();
|
||||
|
||||
auto viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( w->widget() );
|
||||
|
||||
if ( viewWindow && viewWindow->viewWidget() )
|
||||
{
|
||||
if ( w )
|
||||
QWidget* viewWidget = viewWindow->viewWidget();
|
||||
|
||||
viewWidget->resize( width, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowTools::setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWindow, int width, int height )
|
||||
{
|
||||
if ( !mainWindow ) return;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if ( !proj ) return;
|
||||
|
||||
std::vector<RimCase*> projectCases;
|
||||
proj->allCases( projectCases );
|
||||
|
||||
for ( RimCase* cas : projectCases )
|
||||
{
|
||||
if ( !cas ) continue;
|
||||
|
||||
std::vector<Rim3dView*> views = cas->views();
|
||||
|
||||
for ( Rim3dView* riv : views )
|
||||
{
|
||||
if ( riv && riv->viewer() )
|
||||
{
|
||||
w->showNormal();
|
||||
|
||||
auto viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( w->widget() );
|
||||
|
||||
if ( viewWindow && viewWindow->viewWidget() )
|
||||
// Make sure all views are maximized for snapshotting
|
||||
QMdiSubWindow* subWnd = mainWindow->findMdiSubWindow( riv->viewer()->layoutWidget() );
|
||||
if ( subWnd )
|
||||
{
|
||||
QWidget* viewWidget = viewWindow->viewWidget();
|
||||
|
||||
viewWidget->resize( width, height );
|
||||
subWnd->showMaximized();
|
||||
}
|
||||
|
||||
// This size is set to match the regression test reference images
|
||||
QSize windowSize( width, height );
|
||||
|
||||
riv->viewer()->setFixedSize( windowSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,5 +32,7 @@ class RiuMainWindowTools
|
||||
{
|
||||
public:
|
||||
static void collapseSiblings( const caf::PdmUiItem* uiItem );
|
||||
|
||||
static void setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height );
|
||||
static void setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWindow, int width, int height );
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user