mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
(#502) Reduce size of plot window when track is deleted
This commit is contained in:
@@ -76,14 +76,7 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot)
|
|||||||
m_layout->insertWidget(m_layout->count() - 1, trackPlot);
|
m_layout->insertWidget(m_layout->count() - 1, trackPlot);
|
||||||
m_trackPlots.append(trackPlot);
|
m_trackPlots.append(trackPlot);
|
||||||
|
|
||||||
QMdiSubWindow* mdiWindow = RiuMainWindow::instance()->findMdiSubWindow(this);
|
modifyWidthOfContainingMdiWindow(trackPlot->width());
|
||||||
if (mdiWindow)
|
|
||||||
{
|
|
||||||
QSize subWindowSize = mdiWindow->size();
|
|
||||||
subWindowSize.setWidth(subWindowSize.width() + trackPlot->width());
|
|
||||||
|
|
||||||
mdiWindow->resize(subWindowSize);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -93,6 +86,39 @@ void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrackPlot* trackPlot)
|
|||||||
{
|
{
|
||||||
m_layout->removeWidget(trackPlot);
|
m_layout->removeWidget(trackPlot);
|
||||||
m_trackPlots.removeAll(trackPlot);
|
m_trackPlots.removeAll(trackPlot);
|
||||||
|
|
||||||
|
modifyWidthOfContainingMdiWindow(-trackPlot->width());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuWellLogPlot::modifyWidthOfContainingMdiWindow(int widthChange)
|
||||||
|
{
|
||||||
|
QMdiSubWindow* mdiWindow = RiuMainWindow::instance()->findMdiSubWindow(this);
|
||||||
|
if (mdiWindow)
|
||||||
|
{
|
||||||
|
QSize subWindowSize = mdiWindow->size();
|
||||||
|
|
||||||
|
int newWidth = subWindowSize.width() + widthChange;
|
||||||
|
if (newWidth < 0) newWidth = 100;
|
||||||
|
|
||||||
|
subWindowSize.setWidth(newWidth);
|
||||||
|
mdiWindow->resize(subWindowSize);
|
||||||
|
|
||||||
|
if (mdiWindow->isMaximized())
|
||||||
|
{
|
||||||
|
// Set window temporarily to normal state and back to maximized
|
||||||
|
// to redo layout so the whole window canvas is filled
|
||||||
|
// Tried to activate layout, did not work as expected
|
||||||
|
// Tested code:
|
||||||
|
// m_layout->activate();
|
||||||
|
// mdiWindow->layout()->activate();
|
||||||
|
|
||||||
|
mdiWindow->showNormal();
|
||||||
|
mdiWindow->showMaximized();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateScrollBar(double minDepth, double maxDepth);
|
void updateScrollBar(double minDepth, double maxDepth);
|
||||||
|
void modifyWidthOfContainingMdiWindow(int widthChange);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotSetMinDepth(int value);
|
void slotSetMinDepth(int value);
|
||||||
|
|||||||
Reference in New Issue
Block a user