mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Partial revert of 38e0b150
This commit is contained in:
parent
9f927e74f3
commit
a925c0f29e
@ -27,7 +27,6 @@
|
||||
|
||||
#include "RimGridPlotWindow.h"
|
||||
#include "RimPlotInterface.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -47,17 +46,12 @@ bool RicDeleteSubPlotFeature::isCommandEnabled()
|
||||
|
||||
if ( selection.size() > 0 )
|
||||
{
|
||||
size_t plotsSelected = 0;
|
||||
for ( caf::PdmObject* object : selection )
|
||||
RimGridPlotWindow* wellLogPlot = nullptr;
|
||||
selection[0]->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( dynamic_cast<RimPlotInterface*>( selection[0] ) && wellLogPlot && wellLogPlot->plotCount() > 1 )
|
||||
{
|
||||
RimGridPlotWindow* gridPlotWindow = nullptr;
|
||||
object->firstAncestorOrThisOfType( gridPlotWindow );
|
||||
if ( dynamic_cast<RimPlotInterface*>( object ) && gridPlotWindow )
|
||||
{
|
||||
plotsSelected++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return plotsSelected == selection.size();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -72,6 +66,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
std::vector<caf::PdmObject*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
std::set<RimGridPlotWindow*> alteredWellLogPlots;
|
||||
|
||||
for ( size_t i = 0; i < selection.size(); i++ )
|
||||
@ -80,7 +75,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RimGridPlotWindow* wellLogPlot = nullptr;
|
||||
selection[i]->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( plot && wellLogPlot )
|
||||
if ( plot && wellLogPlot && wellLogPlot->plotCount() > 1 )
|
||||
{
|
||||
alteredWellLogPlots.insert( wellLogPlot );
|
||||
wellLogPlot->removePlot( plot );
|
||||
@ -93,6 +88,11 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
for ( RimGridPlotWindow* wellLogPlot : alteredWellLogPlots )
|
||||
{
|
||||
RiuGridPlotWindow* viewWidget = dynamic_cast<RiuGridPlotWindow*>( wellLogPlot->viewWidget() );
|
||||
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredWidth() );
|
||||
// TODO: add back with virtual methods
|
||||
// wellLogPlot->calculateAvailableDepthRange();
|
||||
// wellLogPlot->updateDepthZoom();
|
||||
wellLogPlot->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
@ -102,32 +102,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSubPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
QString actionText;
|
||||
std::vector<caf::PdmObject*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
size_t tracksSelected = 0u;
|
||||
for ( caf::PdmObject* object : selection )
|
||||
{
|
||||
if ( dynamic_cast<RimWellLogTrack*>( object ) )
|
||||
{
|
||||
tracksSelected++;
|
||||
}
|
||||
}
|
||||
if ( tracksSelected == selection.size() )
|
||||
{
|
||||
actionText = "Delete Track";
|
||||
}
|
||||
else
|
||||
{
|
||||
actionText = "Delete Plot";
|
||||
}
|
||||
if ( selection.size() > 1u )
|
||||
{
|
||||
actionText += "s";
|
||||
}
|
||||
|
||||
actionToSetup->setText( actionText );
|
||||
actionToSetup->setText( "Delete Track" );
|
||||
actionToSetup->setIcon( QIcon( ":/Erase.png" ) );
|
||||
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
|
||||
}
|
||||
|
@ -64,8 +64,11 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered( bool isChecked )
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack;
|
||||
wellLogPlot->addPlot( plotTrack );
|
||||
plotTrack->setDescription( QString( "Track %1" ).arg( wellLogPlot->plotCount() ) );
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>( wellLogPlot->viewWidget() );
|
||||
RicWellLogTools::addWellLogExtractionCurve( plotTrack, nullptr, nullptr, nullptr, nullptr, -1, true );
|
||||
|
||||
plotWindow->setWidthOfMdiWindow( viewWidget, viewWidget->preferredWidth() );
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
wellLogPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -137,7 +137,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.h
|
||||
)
|
||||
|
||||
|
||||
@ -279,7 +278,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGridPlotWindowCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimGridPlotWindowCollection.h"
|
||||
#include "RimPltPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRftPlotCollection.h"
|
||||
@ -85,9 +84,6 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
"" );
|
||||
m_saturationPressurePlotCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_combinationPlotCollection, "RimGridPlotWindowCollection", "Combination Plots", "", "", "" );
|
||||
m_combinationPlotCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
||||
m_rftPlotCollection = new RimRftPlotCollection();
|
||||
m_pltPlotCollection = new RimPltPlotCollection();
|
||||
@ -184,14 +180,6 @@ RimSaturationPressurePlotCollection* RimMainPlotCollection::saturationPressurePl
|
||||
return m_saturationPressurePlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridPlotWindowCollection* RimMainPlotCollection::combinationPlotCollection()
|
||||
{
|
||||
return m_combinationPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -205,7 +193,6 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_gridCrossPlotCollection->deleteAllChildObjects();
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
m_saturationPressurePlotCollection()->deleteAllChildObjects();
|
||||
m_combinationPlotCollection()->deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -257,14 +244,6 @@ void RimMainPlotCollection::updatePlotsWithFormations()
|
||||
crossPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_combinationPlotCollection )
|
||||
{
|
||||
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
|
||||
{
|
||||
plotWindow->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -279,14 +258,6 @@ void RimMainPlotCollection::updatePlotsWithCompletions()
|
||||
wellLogPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_combinationPlotCollection )
|
||||
{
|
||||
for ( RimGridPlotWindow* plotWindow : m_combinationPlotCollection->gridPlotWindows() )
|
||||
{
|
||||
plotWindow->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -30,7 +30,6 @@ class RimWellLogPlotCollection;
|
||||
class RimRftPlotCollection;
|
||||
class RimPltPlotCollection;
|
||||
class RimGridCrossPlotCollection;
|
||||
class RimGridPlotWindowCollection;
|
||||
class RimSummaryPlotCollection;
|
||||
class RimSummaryCrossPlotCollection;
|
||||
class RimSummaryPlot;
|
||||
@ -59,7 +58,6 @@ public:
|
||||
RimFlowPlotCollection* flowPlotCollection();
|
||||
RimGridCrossPlotCollection* gridCrossPlotCollection();
|
||||
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
|
||||
RimGridPlotWindowCollection* combinationPlotCollection();
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
void updateCurrentTimeStepInPlots();
|
||||
@ -83,7 +81,6 @@ private:
|
||||
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
|
||||
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
|
||||
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
|
||||
caf::PdmChildField<RimGridPlotWindowCollection*> m_combinationPlotCollection;
|
||||
|
||||
caf::PdmField<bool> m_show;
|
||||
};
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechModels.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimGridPlotWindowCollection.h"
|
||||
#include "RimGridSummaryCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
@ -1304,10 +1303,6 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
{
|
||||
itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() );
|
||||
}
|
||||
if ( mainPlotCollection->combinationPlotCollection() )
|
||||
{
|
||||
itemCollection->add( mainPlotCollection->combinationPlotCollection() );
|
||||
}
|
||||
}
|
||||
|
||||
uiTreeOrdering.add( m_plotTemplateFolderItem() );
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimGridPlotWindowCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
@ -177,14 +176,5 @@ void RimReloadCaseTools::updateAllPlots()
|
||||
{
|
||||
flowPlotCollection->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
RimGridPlotWindowCollection* gridPlotWindowCollection = project->mainPlotCollection()->combinationPlotCollection();
|
||||
if ( gridPlotWindowCollection )
|
||||
{
|
||||
for ( RimGridPlotWindow* plotWindow : gridPlotWindowCollection->gridPlotWindows() )
|
||||
{
|
||||
plotWindow->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
|
||||
m_plotLayout->addWidget( m_plotWidgetFrame, 1 );
|
||||
|
||||
m_gridLayout = new QGridLayout( m_plotWidgetFrame );
|
||||
m_gridLayout->setContentsMargins( 1, 1, 1, 1 );
|
||||
m_gridLayout->setSpacing( 1 );
|
||||
m_gridLayout->setMargin( 0 );
|
||||
m_gridLayout->setSpacing( 2 );
|
||||
|
||||
QPalette newPalette( palette() );
|
||||
newPalette.setColor( QPalette::Background, Qt::white );
|
||||
@ -96,13 +96,6 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
|
||||
|
||||
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
|
||||
|
||||
m_dropTargetPlaceHolder = new QLabel( "Drag plots here" );
|
||||
m_dropTargetPlaceHolder->setAlignment( Qt::AlignCenter );
|
||||
m_dropTargetPlaceHolder->setObjectName(
|
||||
QString( "%1" ).arg( reinterpret_cast<uint64_t>( m_dropTargetPlaceHolder.data() ) ) );
|
||||
m_dropTargetStyleSheet = createDropTargetStyleSheet();
|
||||
m_dropTargetStyleSheet.applyToWidget( m_dropTargetPlaceHolder );
|
||||
|
||||
this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
|
||||
|
||||
setFocusPolicy( Qt::StrongFocus );
|
||||
@ -112,8 +105,6 @@ RiuGridPlotWindow::RiuGridPlotWindow( RimGridPlotWindow* plotDefinition, QWidget
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
int defaultFontSize = RiaFontCache::pointSizeFromFontSizeEnum( app->preferences()->defaultPlotFontSize() );
|
||||
setFontSize( defaultFontSize );
|
||||
|
||||
this->setObjectName( QString( "%1" ).arg( reinterpret_cast<uint64_t>( this ) ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -211,6 +202,28 @@ void RiuGridPlotWindow::setPlotTitle( const QString& plotTitle )
|
||||
m_plotTitle->setText( plotTitle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiuGridPlotWindow::preferredWidth() const
|
||||
{
|
||||
int titleWidth = 0;
|
||||
if ( m_plotTitle && m_plotTitle->isVisible() )
|
||||
{
|
||||
titleWidth = m_plotTitle->width();
|
||||
}
|
||||
|
||||
QList<QPointer<RiuQwtPlotWidget>> visiblePlotWidgets = this->visiblePlotWidgets();
|
||||
auto rowAndColumnCount = this->rowAndColumnCount( visiblePlotWidgets.size() );
|
||||
|
||||
int sumColumnWidths = 0;
|
||||
for ( int visibleIndex = 0; visibleIndex < rowAndColumnCount.second; ++visibleIndex )
|
||||
{
|
||||
sumColumnWidths += visiblePlotWidgets[visibleIndex]->width();
|
||||
}
|
||||
return std::max( titleWidth, sumColumnWidths );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -377,10 +390,8 @@ void RiuGridPlotWindow::showEvent( QShowEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridPlotWindow::dragEnterEvent( QDragEnterEvent* event )
|
||||
{
|
||||
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
|
||||
if ( source )
|
||||
if ( this->geometry().contains( event->pos() ) )
|
||||
{
|
||||
setWidgetState( RiuWidgetStyleSheet::DRAG_TARGET_INTO );
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
@ -390,13 +401,11 @@ void RiuGridPlotWindow::dragEnterEvent( QDragEnterEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
|
||||
{
|
||||
if ( event->answerRect().intersects( this->geometry() ) )
|
||||
if ( this->geometry().contains( event->pos() ) )
|
||||
{
|
||||
RiuQwtPlotWidget* source = dynamic_cast<RiuQwtPlotWidget*>( event->source() );
|
||||
if ( source )
|
||||
{
|
||||
setWidgetState( RiuWidgetStyleSheet::DRAG_TARGET_INTO );
|
||||
|
||||
QRect originalGeometry = source->geometry();
|
||||
QPoint offset = source->dragStartPosition();
|
||||
QRect newRect( event->pos() - offset, originalGeometry.size() );
|
||||
@ -422,8 +431,9 @@ void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
|
||||
{
|
||||
int insertAfterIndex = insertBeforeIndex - 1;
|
||||
visiblePlotWidgets[insertAfterIndex]->setWidgetState( RiuWidgetStyleSheet::DRAG_TARGET_AFTER );
|
||||
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -433,8 +443,6 @@ void RiuGridPlotWindow::dragMoveEvent( QDragMoveEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
|
||||
{
|
||||
setWidgetState( RiuWidgetStyleSheet::DEFAULT );
|
||||
|
||||
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
|
||||
{
|
||||
m_plotWidgets[tIdx]->setWidgetState( RiuWidgetStyleSheet::DEFAULT );
|
||||
@ -446,8 +454,6 @@ void RiuGridPlotWindow::dragLeaveEvent( QDragLeaveEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridPlotWindow::dropEvent( QDropEvent* event )
|
||||
{
|
||||
setWidgetState( RiuWidgetStyleSheet::DEFAULT );
|
||||
|
||||
for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx )
|
||||
{
|
||||
m_plotWidgets[tIdx]->setWidgetState( RiuWidgetStyleSheet::DEFAULT );
|
||||
@ -527,14 +533,6 @@ void RiuGridPlotWindow::onSelectionManagerSelectionChanged( const std::set<int>&
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridPlotWindow::setWidgetState( RiuWidgetStyleSheet::StateTag widgetState )
|
||||
{
|
||||
m_dropTargetStyleSheet.setWidgetState( m_dropTargetPlaceHolder, widgetState );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -591,65 +589,54 @@ void RiuGridPlotWindow::reinsertPlotWidgetsAndScrollbar()
|
||||
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
|
||||
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
|
||||
|
||||
if ( plotWidgets.empty() )
|
||||
{
|
||||
m_gridLayout->addWidget( m_dropTargetPlaceHolder, 0, 0 );
|
||||
m_dropTargetPlaceHolder->setVisible( true );
|
||||
m_scrollBar->setVisible( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dropTargetPlaceHolder->setVisible( false );
|
||||
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
||||
|
||||
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
|
||||
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
||||
{
|
||||
int row = visibleIndex / rowAndColumnCount.second;
|
||||
int column = visibleIndex % rowAndColumnCount.second;
|
||||
|
||||
for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex )
|
||||
m_gridLayout->addWidget( legends[visibleIndex], 2 * row, column );
|
||||
m_gridLayout->addWidget( plotWidgets[visibleIndex], 2 * row + 1, column );
|
||||
|
||||
if ( m_plotDefinition->legendsVisible() )
|
||||
{
|
||||
int row = visibleIndex / rowAndColumnCount.second;
|
||||
int column = visibleIndex % rowAndColumnCount.second;
|
||||
|
||||
m_gridLayout->addWidget( legends[visibleIndex], 2 * row, column );
|
||||
m_gridLayout->addWidget( plotWidgets[visibleIndex], 2 * row + 1, column );
|
||||
|
||||
if ( m_plotDefinition->legendsVisible() )
|
||||
int legendColumns = 1;
|
||||
if ( m_plotDefinition->legendsHorizontal() )
|
||||
{
|
||||
int legendColumns = 1;
|
||||
if ( m_plotDefinition->legendsHorizontal() )
|
||||
{
|
||||
legendColumns = 0; // unlimited
|
||||
}
|
||||
legends[visibleIndex]->setMaxColumns( legendColumns );
|
||||
int minimumHeight = legends[visibleIndex]->heightForWidth( plotWidgets[visibleIndex]->width() );
|
||||
legends[visibleIndex]->setMinimumHeight( minimumHeight );
|
||||
QFont legendFont = legends[visibleIndex]->font();
|
||||
legendFont.setPointSize( fontSize() - 1 );
|
||||
legends[visibleIndex]->setFont( legendFont );
|
||||
legends[visibleIndex]->show();
|
||||
legendColumns = 0; // unlimited
|
||||
}
|
||||
else
|
||||
{
|
||||
legends[visibleIndex]->hide();
|
||||
}
|
||||
|
||||
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, column == 0 );
|
||||
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, column == 0 );
|
||||
|
||||
plotWidgets[visibleIndex]->show();
|
||||
|
||||
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
|
||||
if ( column == 0 )
|
||||
{
|
||||
widthScaleFactor += 1; // Give it a bit extra room due to axis
|
||||
}
|
||||
m_gridLayout->setColumnStretch( column,
|
||||
std::max( m_gridLayout->columnStretch( column ),
|
||||
plotWidgets[visibleIndex]->widthScaleFactor() ) );
|
||||
m_gridLayout->setRowStretch( 2 * row + 1, 1 );
|
||||
legends[visibleIndex]->setMaxColumns( legendColumns );
|
||||
int minimumHeight = legends[visibleIndex]->heightForWidth( plotWidgets[visibleIndex]->width() );
|
||||
legends[visibleIndex]->setMinimumHeight( minimumHeight );
|
||||
QFont legendFont = legends[visibleIndex]->font();
|
||||
legendFont.setPointSize( fontSize() - 1 );
|
||||
legends[visibleIndex]->setFont( legendFont );
|
||||
legends[visibleIndex]->show();
|
||||
}
|
||||
m_gridLayout->addLayout( m_scrollBarLayout, 1, rowAndColumnCount.second, rowAndColumnCount.first * 2 - 1, 1 );
|
||||
m_gridLayout->setColumnStretch( rowAndColumnCount.second, 0 );
|
||||
m_scrollBar->setVisible( true );
|
||||
else
|
||||
{
|
||||
legends[visibleIndex]->hide();
|
||||
}
|
||||
|
||||
plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, column == 0 );
|
||||
plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, column == 0 );
|
||||
|
||||
plotWidgets[visibleIndex]->show();
|
||||
|
||||
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
|
||||
if ( column == 0 )
|
||||
{
|
||||
widthScaleFactor += 1; // Give it a bit extra room due to axis
|
||||
}
|
||||
m_gridLayout->setColumnStretch( column,
|
||||
std::max( m_gridLayout->columnStretch( column ),
|
||||
plotWidgets[visibleIndex]->widthScaleFactor() ) );
|
||||
m_gridLayout->setRowStretch( 2 * row + 1, 1 );
|
||||
}
|
||||
m_gridLayout->addLayout( m_scrollBarLayout, 1, rowAndColumnCount.second, rowAndColumnCount.first * 2 - 1, 1 );
|
||||
m_gridLayout->setColumnStretch( rowAndColumnCount.second, 0 );
|
||||
m_scrollBar->setVisible( plotWidgets.size() > 0 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -675,22 +662,6 @@ void RiuGridPlotWindow::clearGridLayout()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWidgetStyleSheet RiuGridPlotWindow::createDropTargetStyleSheet()
|
||||
{
|
||||
RiuWidgetStyleSheet styleSheet;
|
||||
|
||||
styleSheet.set( "background-color", "white" );
|
||||
styleSheet.set( "border", "1px solid black" );
|
||||
styleSheet.set( "font-size", "14pt" );
|
||||
styleSheet.state( RiuWidgetStyleSheet::DRAG_TARGET_INTO ).set( "border", "1px solid lime" );
|
||||
styleSheet.state( RiuWidgetStyleSheet::DRAG_TARGET_INTO ).set( "background-color", "#DDFFDD" );
|
||||
|
||||
return styleSheet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,7 +20,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiuInterfaceToViewWindow.h"
|
||||
#include "RiuWidgetStyleSheet.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafSelectionChangedReceiver.h"
|
||||
@ -65,6 +64,7 @@ public:
|
||||
void removePlot( RiuQwtPlotWidget* plotWidget );
|
||||
|
||||
void setPlotTitle( const QString& plotTitle );
|
||||
int preferredWidth() const;
|
||||
|
||||
void setTitleVisible( bool visible );
|
||||
void setScrollbarVisible( bool visible );
|
||||
@ -95,15 +95,13 @@ protected:
|
||||
|
||||
virtual void onSelectionManagerSelectionChanged( const std::set<int>& changedSelectionLevels ) override;
|
||||
|
||||
void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState );
|
||||
private slots:
|
||||
void performUpdate();
|
||||
|
||||
private:
|
||||
void alignCanvasTopsAndScrollbar();
|
||||
void reinsertPlotWidgetsAndScrollbar();
|
||||
void clearGridLayout();
|
||||
RiuWidgetStyleSheet createDropTargetStyleSheet();
|
||||
void alignCanvasTopsAndScrollbar();
|
||||
void reinsertPlotWidgetsAndScrollbar();
|
||||
void clearGridLayout();
|
||||
|
||||
QList<QPointer<RiuQwtPlotWidget>> visiblePlotWidgets() const;
|
||||
QList<QPointer<RiuQwtPlotLegend>> visibleLegends() const;
|
||||
@ -120,9 +118,6 @@ protected:
|
||||
QList<int> m_legendColumns;
|
||||
QList<QPointer<RiuQwtPlotWidget>> m_plotWidgets;
|
||||
caf::PdmPointer<RimGridPlotWindow> m_plotDefinition;
|
||||
QPointer<QLabel> m_dropTargetPlaceHolder;
|
||||
|
||||
RiuWidgetStyleSheet m_dropTargetStyleSheet;
|
||||
|
||||
private:
|
||||
friend class RiaPlotWindowRedrawScheduler;
|
||||
|
@ -631,7 +631,15 @@ void RiuPlotMainWindow::addViewer( QWidget* viewer, const RimMdiWindowGeometry&
|
||||
}
|
||||
else
|
||||
{
|
||||
subWindowSize = QSize( 400, 400 );
|
||||
RiuGridPlotWindow* wellLogPlot = dynamic_cast<RiuGridPlotWindow*>( viewer );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
subWindowSize = QSize( wellLogPlot->preferredWidth(), m_mdiArea->height() );
|
||||
}
|
||||
else
|
||||
{
|
||||
subWindowSize = QSize( 400, 400 );
|
||||
}
|
||||
}
|
||||
|
||||
addViewerToMdiArea( m_mdiArea, viewer, subWindowPos, subWindowSize );
|
||||
|
Loading…
Reference in New Issue
Block a user