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 )
|
if ( snapshotHeight > -1 && snapshotWidth > -1 )
|
||||||
{
|
{
|
||||||
QSize windowSize( snapshotWidth, snapshotHeight );
|
RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, snapshotWidth, snapshotHeight );
|
||||||
RiaRegressionTestRunner::setFixedWindowSizeFor3dViews( windowSize );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processEvents();
|
processEvents();
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuMainWindowTools.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
#include "RiuViewer.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();
|
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||||
if ( !mainWnd ) return;
|
if ( !mainWnd ) return;
|
||||||
|
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize();
|
||||||
if ( !proj ) return;
|
|
||||||
|
|
||||||
std::vector<RimCase*> projectCases;
|
RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() );
|
||||||
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() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -517,34 +485,12 @@ void RiaRegressionTestRunner::setDefaultFixedWindowSizeFor3dViews()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaRegressionTestRunner::resizePlotWindows()
|
void RiaRegressionTestRunner::resizePlotWindows()
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
|
||||||
if ( !proj ) return;
|
|
||||||
|
|
||||||
RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||||
if ( !plotMainWindow ) return;
|
if ( !plotMainWindow ) return;
|
||||||
|
|
||||||
std::vector<RimViewWindow*> viewWindows;
|
QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize();
|
||||||
|
|
||||||
proj->mainPlotCollection()->descendantsIncludingThisOfType( viewWindows );
|
RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( plotMainWindow, defaultSize.width(), defaultSize.height() );
|
||||||
|
|
||||||
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() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -42,7 +42,6 @@ public:
|
|||||||
bool useOpenMPForGeometryCreation() const;
|
bool useOpenMPForGeometryCreation() const;
|
||||||
|
|
||||||
static void updateRegressionTest( const QString& testRootPath );
|
static void updateRegressionTest( const QString& testRootPath );
|
||||||
static void setFixedWindowSizeFor3dViews( const QSize& snapshotImageSize );
|
|
||||||
static void setDefaultFixedWindowSizeFor3dViews();
|
static void setDefaultFixedWindowSizeFor3dViews();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -22,10 +22,15 @@
|
|||||||
|
|
||||||
#include "RimViewWindow.h"
|
#include "RimViewWindow.h"
|
||||||
|
|
||||||
|
#include "Rim3dView.h"
|
||||||
|
#include "RimCase.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
#include "RiuInterfaceToViewWindow.h"
|
#include "RiuInterfaceToViewWindow.h"
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
#include "RiuMainWindowBase.h"
|
#include "RiuMainWindowBase.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
|
#include "RiuViewer.h"
|
||||||
|
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafPdmUiTreeView.h"
|
#include "cafPdmUiTreeView.h"
|
||||||
@ -95,23 +100,60 @@ void RiuMainWindowTools::collapseSiblings( const caf::PdmUiItem* sourceUiItem )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height )
|
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*>();
|
if ( !w ) continue;
|
||||||
for ( auto w : widgets )
|
|
||||||
|
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();
|
// Make sure all views are maximized for snapshotting
|
||||||
|
QMdiSubWindow* subWnd = mainWindow->findMdiSubWindow( riv->viewer()->layoutWidget() );
|
||||||
auto viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( w->widget() );
|
if ( subWnd )
|
||||||
|
|
||||||
if ( viewWindow && viewWindow->viewWidget() )
|
|
||||||
{
|
{
|
||||||
QWidget* viewWidget = viewWindow->viewWidget();
|
subWnd->showMaximized();
|
||||||
|
|
||||||
viewWidget->resize( width, height );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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:
|
public:
|
||||||
static void collapseSiblings( const caf::PdmUiItem* uiItem );
|
static void collapseSiblings( const caf::PdmUiItem* uiItem );
|
||||||
|
|
||||||
static void setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height );
|
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