mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add preview mode to multi plots
* Apply margins matching the Page Layout so the plot is a preview of the PDF output * Currently not a user setting, just switched off for plots based on MultiPlotPage and on for plots based on MultiPlotWindow
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
RiuMultiPlotPage::RiuMultiPlotPage( RimMultiPlotWindow* plotDefinition, QWidget* parent )
|
||||
: RiuMultiPlotInterface( parent )
|
||||
, m_plotDefinition( plotDefinition )
|
||||
, m_previewMode( false )
|
||||
{
|
||||
Q_ASSERT( plotDefinition );
|
||||
m_plotDefinition = plotDefinition;
|
||||
@@ -288,6 +289,22 @@ int RiuMultiPlotPage::fontSize() const
|
||||
return m_plotTitle->font().pointSize() - 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuMultiPlotPage::previewModeEnabled() const
|
||||
{
|
||||
return m_previewMode;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::setPreviewModeEnabled( bool previewMode )
|
||||
{
|
||||
m_previewMode = previewMode;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -554,10 +571,17 @@ int RiuMultiPlotPage::heightForWidth( int width ) const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMultiPlotPage::updateMarginsFromPageLayout()
|
||||
{
|
||||
QPageLayout pageLayout = m_plotDefinition->pageLayout();
|
||||
const int resolution = RiaGuiApplication::applicationResolution();
|
||||
QMargins margins = pageLayout.marginsPixels( resolution );
|
||||
m_layout->setContentsMargins( margins );
|
||||
if ( m_previewMode )
|
||||
{
|
||||
QPageLayout pageLayout = m_plotDefinition->pageLayout();
|
||||
const int resolution = RiaGuiApplication::applicationResolution();
|
||||
QMargins margins = pageLayout.marginsPixels( resolution );
|
||||
m_layout->setContentsMargins( margins );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user