mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
#739 Moved windowsGeometry data to the RimViewWindow base class
Introduced an interface for setting and getting mdiWindow Geometry Changed file keywords from GraphPlot etc to SummaryPlot Added a summary plot QwtPlot descendant Added handling of delete of the MDI window
This commit is contained in:
parent
38c15f57f2
commit
ae615901b8
@ -91,6 +91,8 @@ set( USER_INTERFACE_FILES
|
||||
UserInterface/RiuProjectPropertyView.cpp
|
||||
UserInterface/RiuResultQwtPlot.h
|
||||
UserInterface/RiuResultQwtPlot.cpp
|
||||
UserInterface/RiuSummaryQwtPlot.h
|
||||
UserInterface/RiuSummaryQwtPlot.cpp
|
||||
UserInterface/RiuSelectionManager.h
|
||||
UserInterface/RiuSelectionManager.cpp
|
||||
UserInterface/RiuSelectionColors.h
|
||||
|
@ -210,7 +210,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget());
|
||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||
|
||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
||||
delete m_viewer;
|
||||
|
@ -500,7 +500,7 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget());
|
||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||
|
||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
||||
delete m_viewer;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RiuResultQwtPlot.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
|
||||
#include "RiuResultQwtPlot.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSelectionColors.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
@ -31,14 +31,14 @@
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "GraphPlot");
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot::RimSummaryPlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Graph", ":/WellLogPlot16x16.png", "", "");
|
||||
CAF_PDM_InitObject("Summary Plot", ":/WellLogPlot16x16.png", "", "");
|
||||
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Summary Plot", "", "", "");
|
||||
m_showWindow.uiCapability()->setUiHidden(true);
|
||||
|
||||
@ -53,6 +53,8 @@ RimSummaryPlot::RimSummaryPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot::~RimSummaryPlot()
|
||||
{
|
||||
RiuMainWindow::instance()->removeViewer(m_qwtPlot);
|
||||
|
||||
deletePlotWidget();
|
||||
|
||||
m_curves.deleteAllChildObjects();
|
||||
@ -70,12 +72,21 @@ void RimSummaryPlot::deletePlotWidget()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuResultQwtPlot* RimSummaryPlot::viewer()
|
||||
void RimSummaryPlot::handleViewerDeletion()
|
||||
{
|
||||
return m_qwtPlot;
|
||||
m_showWindow = false;
|
||||
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
detachAllCurves();
|
||||
}
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -113,6 +124,17 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
this->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_qwtPlot));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -147,14 +169,14 @@ void RimSummaryPlot::updateViewerWidget()
|
||||
{
|
||||
if (!m_qwtPlot)
|
||||
{
|
||||
m_qwtPlot = new RiuResultQwtPlot(RiuMainWindow::instance());
|
||||
m_qwtPlot = new RiuSummaryQwtPlot(this, RiuMainWindow::instance());
|
||||
for (size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
{
|
||||
m_curves[cIdx]->setParentQwtPlot(m_qwtPlot);
|
||||
}
|
||||
|
||||
|
||||
RiuMainWindow::instance()->addViewer(m_qwtPlot, std::vector<int>());
|
||||
RiuMainWindow::instance()->addViewer(m_qwtPlot, this->mdiWindowGeometry());
|
||||
RiuMainWindow::instance()->setActiveViewer(m_qwtPlot);
|
||||
|
||||
}
|
||||
@ -165,14 +187,12 @@ void RimSummaryPlot::updateViewerWidget()
|
||||
{
|
||||
if (m_qwtPlot)
|
||||
{
|
||||
//windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_qwtPlot));
|
||||
|
||||
RiuMainWindow::instance()->removeViewer(m_qwtPlot);
|
||||
detachAllCurves();
|
||||
|
||||
delete m_qwtPlot;
|
||||
m_qwtPlot = NULL;
|
||||
|
||||
deletePlotWidget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
class RiuResultQwtPlot;
|
||||
class RiuSummaryQwtPlot;
|
||||
class RimSummaryCurve;
|
||||
|
||||
//==================================================================================================
|
||||
@ -44,29 +44,25 @@ public:
|
||||
virtual ~RimSummaryPlot();
|
||||
|
||||
void setDescription(const QString& description);
|
||||
void loadDataAndUpdate();
|
||||
RiuResultQwtPlot* viewer();
|
||||
void addCurve(RimSummaryCurve* curve);
|
||||
|
||||
|
||||
void loadDataAndUpdate();
|
||||
void handleViewerDeletion();
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void setupBeforeSave() override;
|
||||
|
||||
private:
|
||||
void updateViewerWidget();
|
||||
|
||||
void detachAllCurves();
|
||||
|
||||
void deletePlotWidget();
|
||||
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
void deletePlotWidget();
|
||||
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
caf::PdmField<QString> m_userName;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
|
||||
QPointer<RiuResultQwtPlot> m_qwtPlot;
|
||||
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||
};
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryPlotCollection, "RimGraphPlotCollection");
|
||||
CAF_PDM_SOURCE_INIT(RimSummaryPlotCollection, "SummaryPlotCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -109,8 +109,6 @@ RimView::RimView(void)
|
||||
|
||||
CAF_PDM_InitField(&m_disableLighting, "DisableLighting", false, "Disable Results Lighting", "", "Disable light model for scalar result colors", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&windowGeometry, "WindowGeometry", "", "", "", "");
|
||||
windowGeometry.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
||||
m_rangeFilterCollection.uiCapability()->setUiHidden(true);
|
||||
@ -205,7 +203,7 @@ void RimView::updateViewerWidget()
|
||||
m_viewer = new RiuViewer(glFormat, NULL);
|
||||
m_viewer->setOwnerReservoirView(this);
|
||||
|
||||
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), windowGeometry());
|
||||
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), mdiWindowGeometry());
|
||||
m_viewer->setMinNearPlaneDistance(10);
|
||||
|
||||
this->resetLegendsInViewer();
|
||||
@ -341,8 +339,8 @@ void RimView::setupBeforeSave()
|
||||
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
||||
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
||||
|
||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget());
|
||||
}
|
||||
setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -93,7 +93,6 @@ public:
|
||||
void setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc);
|
||||
void replaceRangeFilterCollectionWithOverride();
|
||||
|
||||
caf::PdmField< std::vector<int> > windowGeometry;
|
||||
|
||||
caf::PdmChildField<RimCrossSectionCollection*> crossSectionCollection;
|
||||
|
||||
|
@ -8,6 +8,8 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Ab
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow::RimViewWindow(void)
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault(&m_windowGeometry, "WindowGeometry", "", "", "", "");
|
||||
m_windowGeometry.uiCapability()->setUiHidden(true);
|
||||
|
||||
}
|
||||
|
||||
@ -27,4 +29,40 @@ void RimViewWindow::setViewWidget(QWidget* viewWidget)
|
||||
m_viewWidget = viewWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
||||
{
|
||||
std::vector<int> geom;
|
||||
geom.clear();
|
||||
if (windowGeometry.isValid())
|
||||
{
|
||||
geom.push_back(windowGeometry.x);
|
||||
geom.push_back(windowGeometry.y);
|
||||
geom.push_back(windowGeometry.width);
|
||||
geom.push_back(windowGeometry.height);
|
||||
geom.push_back(windowGeometry.isMaximized);
|
||||
}
|
||||
m_windowGeometry.setValue(geom);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry()
|
||||
{
|
||||
|
||||
RimMdiWindowGeometry wg;
|
||||
if (m_windowGeometry.value().size() == 5)
|
||||
{
|
||||
wg.x = m_windowGeometry.value()[0];
|
||||
wg.y = m_windowGeometry.value()[1];
|
||||
wg.width = m_windowGeometry.value()[2];
|
||||
wg.height = m_windowGeometry.value()[3];
|
||||
wg.isMaximized = m_windowGeometry.value()[4];
|
||||
}
|
||||
|
||||
return wg;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,18 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "QPointer"
|
||||
|
||||
struct RimMdiWindowGeometry
|
||||
{
|
||||
RimMdiWindowGeometry() : x(0), y(0), width(-1), height(-1) {}
|
||||
bool isValid() const { return (width >= 0 && height >= 0);}
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
bool isMaximized;
|
||||
};
|
||||
|
||||
class RimViewWindow : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
@ -29,19 +41,20 @@ public:
|
||||
RimViewWindow(void);
|
||||
virtual ~RimViewWindow(void);
|
||||
|
||||
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||
RimMdiWindowGeometry mdiWindowGeometry();
|
||||
|
||||
protected:
|
||||
void setViewWidget(QWidget* viewWidget);
|
||||
void setViewWidget(QWidget* viewWidget);
|
||||
|
||||
// Possible abilities of this class
|
||||
|
||||
//caf::PdmField< std::vector<int> > windowGeometry;
|
||||
//virtual QImage snapshotWindowContent() = 0;
|
||||
//caf::PdmField<QString> name;
|
||||
//caf::PdmField<bool> showWindow;
|
||||
|
||||
|
||||
private:
|
||||
QPointer<QWidget> m_viewWidget;
|
||||
caf::PdmField< std::vector<int> > m_windowGeometry;
|
||||
QPointer<QWidget> m_viewWidget;
|
||||
};
|
||||
|
||||
|
@ -76,9 +76,6 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
|
||||
m_tracks.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&windowGeometry, "WindowGeometry", "", "", "", "");
|
||||
windowGeometry.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_minAvailableDepth = HUGE_VAL;
|
||||
m_maxAvailableDepth = -HUGE_VAL;
|
||||
}
|
||||
@ -109,7 +106,7 @@ void RimWellLogPlot::updateViewerWidget()
|
||||
|
||||
recreateTrackPlots();
|
||||
|
||||
RiuMainWindow::instance()->addViewer(m_viewer, windowGeometry());
|
||||
RiuMainWindow::instance()->addViewer(m_viewer, this->mdiWindowGeometry());
|
||||
RiuMainWindow::instance()->setActiveViewer(m_viewer);
|
||||
}
|
||||
|
||||
@ -119,7 +116,7 @@ void RimWellLogPlot::updateViewerWidget()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer));
|
||||
|
||||
RiuMainWindow::instance()->removeViewer(m_viewer);
|
||||
detachAllCurves();
|
||||
@ -368,7 +365,7 @@ void RimWellLogPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
||||
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,6 @@ public:
|
||||
|
||||
QString depthPlotTitle() const;
|
||||
|
||||
caf::PdmField< std::vector<int> > windowGeometry;
|
||||
|
||||
void addTrack(RimWellLogTrack* track);
|
||||
void insertTrack(RimWellLogTrack* track, size_t index);
|
||||
size_t trackCount() { return m_tracks.size();}
|
||||
|
@ -49,8 +49,10 @@
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimTreeViewStateSerializer.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimWellPathImport.h"
|
||||
|
||||
#include "RiuDragDrop.h"
|
||||
@ -59,6 +61,7 @@
|
||||
#include "RiuProjectPropertyView.h"
|
||||
#include "RiuResultInfoPanel.h"
|
||||
#include "RiuResultQwtPlot.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuTreeViewEventFilter.h"
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuWellImportWizard.h"
|
||||
@ -1216,16 +1219,21 @@ protected:
|
||||
QWidget* mainWidget = widget();
|
||||
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(mainWidget);
|
||||
RiuSummaryQwtPlot* summaryPlot = dynamic_cast<RiuSummaryQwtPlot*>(mainWidget);
|
||||
if (wellLogPlot)
|
||||
{
|
||||
wellLogPlot->ownerPlotDefinition()->windowGeometry = RiuMainWindow::instance()->windowGeometryForWidget(this);
|
||||
wellLogPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
||||
}
|
||||
else if (summaryPlot)
|
||||
{
|
||||
summaryPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
|
||||
if (viewer)
|
||||
{
|
||||
viewer->ownerReservoirView()->windowGeometry = RiuMainWindow::instance()->windowGeometryForWidget(this);
|
||||
viewer->ownerReservoirView()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1236,7 +1244,7 @@ protected:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::addViewer(QWidget* viewer, const std::vector<int>& windowsGeometry)
|
||||
void RiuMainWindow::addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry)
|
||||
{
|
||||
RiuMdiSubWindow* subWin = new RiuMdiSubWindow(m_mdiArea);
|
||||
subWin->setAttribute(Qt::WA_DeleteOnClose); // Make sure the contained widget is destroyed when the MDI window is closed
|
||||
@ -1246,15 +1254,12 @@ void RiuMainWindow::addViewer(QWidget* viewer, const std::vector<int>& windowsGe
|
||||
QPoint subWindowPos(-1, -1);
|
||||
bool initialStateMaximized = false;
|
||||
|
||||
if (windowsGeometry.size() == 5)
|
||||
if (windowsGeometry.isValid())
|
||||
{
|
||||
subWindowPos = QPoint(windowsGeometry[0], windowsGeometry[1]);
|
||||
subWindowSize = QSize(windowsGeometry[2], windowsGeometry[3]);
|
||||
subWindowPos = QPoint(windowsGeometry.x, windowsGeometry.y);
|
||||
subWindowSize = QSize(windowsGeometry.width, windowsGeometry.height);
|
||||
|
||||
if (windowsGeometry[4] > 0)
|
||||
{
|
||||
initialStateMaximized = true;
|
||||
}
|
||||
initialStateMaximized = windowsGeometry.isMaximized;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2214,7 +2219,7 @@ void RiuMainWindow::customMenuRequested(const QPoint& pos)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
||||
RimMdiWindowGeometry RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
||||
{
|
||||
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
||||
if (mdiWindow)
|
||||
@ -2222,24 +2227,24 @@ std::vector<int> RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
||||
return windowGeometryForWidget(mdiWindow);
|
||||
}
|
||||
|
||||
std::vector<int> geo;
|
||||
RimMdiWindowGeometry geo;
|
||||
return geo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
||||
RimMdiWindowGeometry RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
||||
{
|
||||
std::vector<int> geo;
|
||||
RimMdiWindowGeometry geo;
|
||||
|
||||
if (widget)
|
||||
{
|
||||
geo.push_back(widget->pos().x());
|
||||
geo.push_back(widget->pos().y());
|
||||
geo.push_back(widget->size().width());
|
||||
geo.push_back(widget->size().height());
|
||||
geo.push_back(widget->isMaximized());
|
||||
geo.x = widget->pos().x();
|
||||
geo.y = widget->pos().y();
|
||||
geo.width = widget->size().width();
|
||||
geo.height = widget->size().height();
|
||||
geo.isMaximized = widget->isMaximized();
|
||||
}
|
||||
|
||||
return geo;
|
||||
|
@ -43,6 +43,7 @@ class RiuResultInfoPanel;
|
||||
class RiuViewer;
|
||||
class RiuWellLogPlot;
|
||||
class RiuResultQwtPlot;
|
||||
struct RimMdiWindowGeometry;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -78,7 +79,7 @@ public:
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
|
||||
void removeViewer( QWidget* viewer );
|
||||
void addViewer(QWidget* viewer, const std::vector<int>& windowsGeometry);
|
||||
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
|
||||
void setActiveViewer(QWidget* subWindow);
|
||||
|
||||
void setResultInfo(const QString& info) const;
|
||||
@ -106,8 +107,8 @@ public:
|
||||
void addRecentFiles(const QString& file);
|
||||
void removeRecentFiles(const QString& file);
|
||||
|
||||
std::vector<int> windowGeometryForViewer(QWidget* viewer);
|
||||
std::vector<int> windowGeometryForWidget(QWidget* widget);
|
||||
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
|
||||
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
||||
|
||||
void tileWindows();
|
||||
bool isAnyMdiSubWindowVisible();
|
||||
|
126
ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp
Normal file
126
ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "qwt_date_scale_draw.h"
|
||||
#include "qwt_date_scale_engine.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
#include "qwt_plot_grid.h"
|
||||
#include "qwt_plot_layout.h"
|
||||
#include "qwt_scale_engine.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuSummaryQwtPlot::RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* parent) : QwtPlot(parent)
|
||||
{
|
||||
Q_ASSERT(plotDefinition);
|
||||
m_plotDefinition = plotDefinition;
|
||||
|
||||
m_grid = new QwtPlotGrid;
|
||||
m_grid->attach(this);
|
||||
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuSummaryQwtPlot::~RiuSummaryQwtPlot()
|
||||
{
|
||||
m_grid->detach();
|
||||
delete m_grid;
|
||||
|
||||
if (m_plotDefinition)
|
||||
{
|
||||
m_plotDefinition->handleViewerDeletion();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RiuSummaryQwtPlot::ownerPlotDefinition()
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuSummaryQwtPlot::setDefaults()
|
||||
{
|
||||
QPalette newPalette(palette());
|
||||
newPalette.setColor(QPalette::Background, Qt::white);
|
||||
setPalette(newPalette);
|
||||
|
||||
setAutoFillBackground(true);
|
||||
setCanvasBackground(Qt::white);
|
||||
|
||||
QFrame* canvasFrame = dynamic_cast<QFrame*>(canvas());
|
||||
if (canvasFrame)
|
||||
{
|
||||
canvasFrame->setFrameShape(QFrame::NoFrame);
|
||||
}
|
||||
|
||||
canvas()->setMouseTracking(true);
|
||||
canvas()->installEventFilter(this);
|
||||
|
||||
QPen gridPen(Qt::SolidLine);
|
||||
gridPen.setColor(Qt::lightGray);
|
||||
m_grid->setPen(gridPen);
|
||||
|
||||
enableAxis(QwtPlot::xBottom, true);
|
||||
enableAxis(QwtPlot::yLeft, true);
|
||||
enableAxis(QwtPlot::xTop, false);
|
||||
enableAxis(QwtPlot::yRight, false);
|
||||
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
|
||||
QwtDateScaleDraw* scaleDraw = new QwtDateScaleDraw(Qt::UTC);
|
||||
scaleDraw->setDateFormat(QwtDate::Year, QString("dd-MM-yyyy"));
|
||||
|
||||
QwtDateScaleEngine* scaleEngine = new QwtDateScaleEngine(Qt::UTC);
|
||||
setAxisScaleEngine(QwtPlot::xBottom, scaleEngine);
|
||||
setAxisScaleDraw(QwtPlot::xBottom, scaleDraw);
|
||||
|
||||
QFont xAxisFont = axisFont(QwtPlot::xBottom);
|
||||
xAxisFont.setPixelSize(9);
|
||||
setAxisFont(QwtPlot::xBottom, xAxisFont);
|
||||
|
||||
QFont yAxisFont = axisFont(QwtPlot::yLeft);
|
||||
yAxisFont.setPixelSize(9);
|
||||
setAxisFont(QwtPlot::yLeft, yAxisFont);
|
||||
|
||||
QwtText axisTitleY = axisTitle(QwtPlot::yLeft);
|
||||
QFont yAxisTitleFont = axisTitleY.font();
|
||||
yAxisTitleFont.setPixelSize(9);
|
||||
yAxisTitleFont.setBold(false);
|
||||
axisTitleY.setFont(yAxisTitleFont);
|
||||
axisTitleY.setRenderFlags(Qt::AlignRight);
|
||||
setAxisTitle(QwtPlot::yLeft, axisTitleY);
|
||||
|
||||
|
||||
QwtLegend* legend = new QwtLegend(this);
|
||||
// The legend will be deleted in the destructor of the plot or when
|
||||
// another legend is inserted.
|
||||
this->insertLegend(legend, BottomLegend);
|
||||
}
|
51
ApplicationCode/UserInterface/RiuSummaryQwtPlot.h
Normal file
51
ApplicationCode/UserInterface/RiuSummaryQwtPlot.h
Normal file
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class QwtPlotCurve;
|
||||
class QwtPlotGrid;
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuSummaryQwtPlot : public QwtPlot
|
||||
{
|
||||
public:
|
||||
RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* parent = NULL);
|
||||
virtual ~RiuSummaryQwtPlot();
|
||||
|
||||
RimSummaryPlot* ownerPlotDefinition();
|
||||
|
||||
private:
|
||||
void setDefaults();
|
||||
|
||||
private:
|
||||
QwtPlotGrid* m_grid;
|
||||
caf::PdmPointer<RimSummaryPlot> m_plotDefinition;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user