Simplify Well Log Plot events and updating

This commit is contained in:
Gaute Lindkvist
2019-10-03 15:32:35 +02:00
parent 2cc822399b
commit 1309db884d
2 changed files with 9 additions and 47 deletions

View File

@@ -67,11 +67,11 @@ RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent
m_plotLayout = new QHBoxLayout;
m_layout->addLayout( m_plotLayout );
m_plotFrame = new QFrame;
m_plotFrame->setVisible( true );
m_plotLayout->addWidget( m_plotFrame, 1 );
m_trackFrame = new QFrame;
m_trackFrame->setVisible( true );
m_plotLayout->addWidget( m_trackFrame, 1 );
m_trackLayout = new QGridLayout( m_plotFrame );
m_trackLayout = new QGridLayout( m_trackFrame );
m_trackLayout->setMargin( 0 );
m_trackLayout->setSpacing( 2 );
@@ -217,7 +217,6 @@ int RiuWellLogPlot::preferredWidth() const
void RiuWellLogPlot::setTitleVisible( bool visible )
{
m_plotTitle->setVisible( visible );
this->updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
@@ -229,25 +228,6 @@ void RiuWellLogPlot::updateChildrenLayout()
alignCanvasTops();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::showEvent( QShowEvent* )
{
updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::changeEvent( QEvent* event )
{
if ( event->type() == QEvent::WindowStateChange )
{
updateChildrenLayout();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -277,22 +257,6 @@ void RiuWellLogPlot::keyPressEvent( QKeyEvent* keyEvent )
m_plotDefinition->handleKeyPressEvent( keyEvent );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::resizeEvent( QResizeEvent* event )
{
QWidget::resizeEvent( event );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellLogPlot::sizeHint() const
{
return QSize( 1, 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -414,7 +378,9 @@ void RiuWellLogPlot::clearTrackLayout()
{
}
QWidget().setLayout( m_trackLayout );
m_trackLayout = new QGridLayout( m_plotFrame );
QPointer<QGridLayout> newGridLayout = new QGridLayout( m_trackFrame );
m_trackLayout.swap( newGridLayout );
newGridLayout->deleteLater();
}
}

View File

@@ -71,13 +71,8 @@ public slots:
void updateChildrenLayout();
protected:
void showEvent( QShowEvent* ) override;
void changeEvent( QEvent* event ) override;
void contextMenuEvent( QContextMenuEvent* ) override;
void keyPressEvent( QKeyEvent* keyEvent ) override;
void resizeEvent( QResizeEvent* event ) override;
QSize sizeHint() const override;
QLabel* createTitleLabel() const;
@@ -86,13 +81,14 @@ private:
void alignCanvasTops();
void reinsertTracks();
void clearTrackLayout();
private slots:
void slotSetMinDepth( int value );
protected:
QPointer<QVBoxLayout> m_layout;
QPointer<QHBoxLayout> m_plotLayout;
QPointer<QFrame> m_plotFrame;
QPointer<QFrame> m_trackFrame;
QPointer<QGridLayout> m_trackLayout;
QPointer<QLabel> m_plotTitle;
QPointer<QVBoxLayout> m_scrollBarLayout;