mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3136 Fix RFT/PLT plots and refactor the way Mdi windows are resized when adding/removing plot tracks.
This commit is contained in:
parent
28993dae49
commit
4112682b6a
@ -18,9 +18,13 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicDeleteWellLogPlotTrackFeature.h"
|
||||
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "RimWellLogTrack.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
@ -63,6 +67,8 @@ void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
std::vector<RimWellLogTrack*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
std::set<RimWellLogPlot*> alteredWellLogPlots;
|
||||
|
||||
for (size_t i = 0; i < selection.size(); i++)
|
||||
{
|
||||
@ -72,15 +78,23 @@ void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
|
||||
track->firstAncestorOrThisOfType(wellLogPlot);
|
||||
if (wellLogPlot && wellLogPlot->trackCount() > 1)
|
||||
{
|
||||
alteredWellLogPlots.insert(wellLogPlot);
|
||||
wellLogPlot->removeTrack(track);
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections(track);
|
||||
delete track;
|
||||
|
||||
wellLogPlot->calculateAvailableDepthRange();
|
||||
wellLogPlot->updateDepthZoom();
|
||||
wellLogPlot->uiCapability()->updateConnectedEditors();
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
delete track;
|
||||
}
|
||||
}
|
||||
|
||||
for (RimWellLogPlot* wellLogPlot : alteredWellLogPlots)
|
||||
{
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>(wellLogPlot->viewWidget());
|
||||
plotWindow->setWidthOfMdiWindow(viewWidget, viewWidget->preferredSize().width());
|
||||
wellLogPlot->calculateAvailableDepthRange();
|
||||
wellLogPlot->updateDepthZoom();
|
||||
wellLogPlot->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
#include "RicNewWellLogPlotTrackFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "RicNewWellLogCurveExtractionFeature.h"
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
#include "RicWellLogTools.h"
|
||||
@ -26,6 +31,7 @@
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
@ -60,9 +66,13 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack;
|
||||
wellLogPlot->addTrack(plotTrack);
|
||||
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
|
||||
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>(wellLogPlot->viewWidget());
|
||||
RicWellLogTools::addExtractionCurve(plotTrack, nullptr, nullptr, nullptr, -1, true);
|
||||
|
||||
plotWindow->setWidthOfMdiWindow(viewWidget, viewWidget->preferredSize().width());
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
wellLogPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
#include "RicWellLogPlotTrackFeatureImpl.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
@ -89,6 +94,8 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
|
||||
{
|
||||
CVF_ASSERT(dstWellLogPlot);
|
||||
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
|
||||
std::set<RimWellLogPlot*> srcPlots;
|
||||
|
||||
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
|
||||
@ -100,13 +107,17 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
|
||||
if (srcPlot)
|
||||
{
|
||||
srcPlot->removeTrack(track);
|
||||
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
|
||||
srcPlots.insert(srcPlot);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::set<RimWellLogPlot*>::iterator pIt = srcPlots.begin(); pIt != srcPlots.end(); ++pIt)
|
||||
{
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>((*pIt)->viewWidget());
|
||||
plotWindow->setWidthOfMdiWindow(viewWidget, viewWidget->preferredSize().width());
|
||||
|
||||
(*pIt)->calculateAvailableDepthRange();
|
||||
(*pIt)->updateTrackNames();
|
||||
(*pIt)->updateDepthZoom();
|
||||
@ -120,7 +131,10 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
|
||||
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
|
||||
{
|
||||
dstWellLogPlot->insertTrack(tracksToMove[tIdx], insertionStartIndex + tIdx);
|
||||
|
||||
}
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>(dstWellLogPlot->viewWidget());
|
||||
plotWindow->setWidthOfMdiWindow(viewWidget, viewWidget->preferredSize().width());
|
||||
|
||||
dstWellLogPlot->updateTrackNames();
|
||||
dstWellLogPlot->updateTracks();
|
||||
|
@ -104,6 +104,22 @@ RimWellLogPlot::~RimWellLogPlot()
|
||||
deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::createPlotWidget()
|
||||
{
|
||||
return createViewWidget(nullptr);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -220,14 +236,6 @@ QImage RimWellLogPlot::snapshotWindowContent()
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::updateViewWidgetAfterCreation()
|
||||
{
|
||||
recreateTrackPlots();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -269,46 +277,6 @@ void RimWellLogPlot::removeTrack(RimWellLogTrack* track)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::removeTrackByIndex(size_t index)
|
||||
{
|
||||
CVF_ASSERT(index < m_tracks.size());
|
||||
|
||||
RimWellLogTrack* track = m_tracks[index];
|
||||
this->removeTrack(track);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove)
|
||||
{
|
||||
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
|
||||
{
|
||||
RimWellLogTrack* track = tracksToMove[tIdx];
|
||||
|
||||
RimWellLogPlot* wellLogPlot;
|
||||
track->firstAncestorOrThisOfType(wellLogPlot);
|
||||
if (wellLogPlot)
|
||||
{
|
||||
wellLogPlot->removeTrack(track);
|
||||
wellLogPlot->updateTrackNames();
|
||||
wellLogPlot->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
size_t index = m_tracks.index(insertAfterTrack) + 1;
|
||||
|
||||
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
|
||||
{
|
||||
insertTrack(tracksToMove[tIdx], index + tIdx);
|
||||
}
|
||||
|
||||
updateTrackNames();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -422,14 +390,6 @@ void RimWellLogPlot::zoomAll()
|
||||
updateTracks(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellLogPlot::viewWidget()
|
||||
{
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -769,6 +729,7 @@ QString RimWellLogPlot::description() const
|
||||
QWidget* RimWellLogPlot::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
m_viewer = new RiuWellLogPlot(this, mainWindowParent);
|
||||
recreateTrackPlots();
|
||||
return m_viewer;
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,9 @@ public:
|
||||
RimWellLogPlot();
|
||||
virtual ~RimWellLogPlot();
|
||||
|
||||
QWidget* createPlotWidget();
|
||||
virtual QWidget* viewWidget() override;
|
||||
|
||||
void setDescription(const QString& description);
|
||||
QString description() const;
|
||||
|
||||
@ -80,11 +83,9 @@ public:
|
||||
void addTrack(RimWellLogTrack* track);
|
||||
void insertTrack(RimWellLogTrack* track, size_t index);
|
||||
size_t trackCount() { return m_tracks.size();}
|
||||
void removeTrackByIndex(size_t index);
|
||||
|
||||
void removeTrack(RimWellLogTrack* track);
|
||||
size_t trackIndex(RimWellLogTrack* track);
|
||||
void moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove);
|
||||
|
||||
RimWellLogTrack* trackByIndex(size_t index);
|
||||
|
||||
@ -102,7 +103,6 @@ public:
|
||||
bool hasAvailableDepthRange() const;
|
||||
|
||||
virtual void zoomAll() override;
|
||||
virtual QWidget* viewWidget() override;
|
||||
void setDepthAutoZoom(bool on);
|
||||
|
||||
|
||||
@ -126,7 +126,9 @@ protected:
|
||||
virtual void onLoadDataAndUpdate() override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
virtual void updateViewWidgetAfterCreation() override;
|
||||
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
private:
|
||||
void applyZoomAllDepths();
|
||||
@ -136,11 +138,6 @@ private:
|
||||
|
||||
void updateDisabledDepthTypes();
|
||||
void updatePlotTitle();
|
||||
public: // Needed by RiuWellAllocation Plot
|
||||
// RimViewWindow overrides
|
||||
|
||||
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
|
||||
virtual void deleteViewWidget() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
@ -422,6 +422,35 @@ QList<QMdiSubWindow*> RiuPlotMainWindow::subWindowList(QMdiArea::WindowOrder ord
|
||||
return m_mdiArea->subWindowList(order);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::setWidthOfMdiWindow(QWidget* mdiWindowWidget, int newWidth)
|
||||
{
|
||||
QMdiSubWindow* mdiWindow = findMdiSubWindow(mdiWindowWidget);
|
||||
if (mdiWindow)
|
||||
{
|
||||
QSize subWindowSize = mdiWindow->size();
|
||||
int currentWidth = subWindowSize.width();
|
||||
|
||||
subWindowSize.setWidth(std::max(newWidth, 100));
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -498,7 +527,9 @@ void RiuPlotMainWindow::addViewer(QWidget* viewer, const RimMdiWindowGeometry& w
|
||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(subWin->widget());
|
||||
if (wellLogPlot)
|
||||
{
|
||||
subWindowSize = QSize(275, m_mdiArea->height());
|
||||
QSize preferredSize = wellLogPlot->preferredSize();
|
||||
subWindowSize =
|
||||
QSize(preferredSize.width(), m_mdiArea->height());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -77,6 +77,7 @@ public:
|
||||
QMdiSubWindow* findMdiSubWindow(QWidget* viewer);
|
||||
QList<QMdiSubWindow*> subWindowList(QMdiArea::WindowOrder order);
|
||||
|
||||
void setWidthOfMdiWindow(QWidget* mdiWindowWidget, int newWidth);
|
||||
void addToTemporaryWidgets(QWidget* widget);
|
||||
|
||||
void updateSummaryPlotToolBar();
|
||||
|
@ -94,7 +94,7 @@ RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefiniti
|
||||
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
|
||||
rightColumnLayout->addStretch();
|
||||
|
||||
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createViewWidget(this);
|
||||
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget();
|
||||
|
||||
plotWidgetsLayout->addWidget(wellFlowWidget);
|
||||
}
|
||||
|
@ -120,8 +120,6 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
|
||||
legend->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(updateLegend(const QVariant &, const QList< QwtLegendData > &)));
|
||||
legend->contentsWidget()->layout()->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
|
||||
m_legends.insert(static_cast<int>(index), legend);
|
||||
|
||||
this->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(scheduleUpdateChildrenLayout()));
|
||||
|
||||
if (!m_plotDefinition->areTrackLegendsVisible())
|
||||
{
|
||||
@ -138,8 +136,6 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
|
||||
{
|
||||
trackPlot->hide();
|
||||
}
|
||||
|
||||
modifyWidthOfContainingMdiWindow(trackPlot->width());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -149,8 +145,6 @@ void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrack* trackPlot)
|
||||
{
|
||||
if (!trackPlot) return;
|
||||
|
||||
int windowWidthChange = - trackPlot->width();
|
||||
|
||||
int trackIdx = m_trackPlots.indexOf(trackPlot);
|
||||
CVF_ASSERT(trackIdx >= 0);
|
||||
|
||||
@ -160,51 +154,6 @@ void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrack* trackPlot)
|
||||
QwtLegend* legend = m_legends[trackIdx];
|
||||
m_legends.removeAt(trackIdx);
|
||||
delete legend;
|
||||
|
||||
modifyWidthOfContainingMdiWindow(windowWidthChange);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellLogPlot::modifyWidthOfContainingMdiWindow(int widthChange)
|
||||
{
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
QMdiSubWindow* mdiWindow = plotWindow->findMdiSubWindow(this);
|
||||
if (mdiWindow)
|
||||
{
|
||||
if (m_trackPlots.size() == 0 && widthChange <= 0) return; // Last track removed. Leave be
|
||||
|
||||
QSize subWindowSize = mdiWindow->size();
|
||||
int newWidth = 0;
|
||||
|
||||
if (m_trackPlots.size() == 1 && widthChange > 0) // First track added
|
||||
{
|
||||
newWidth = widthChange;
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -233,9 +182,24 @@ void RiuWellLogPlot::setPlotTitle(const QString& plotTitle)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuWellLogPlot::sizeHint() const
|
||||
QSize RiuWellLogPlot::preferredSize() const
|
||||
{
|
||||
return QSize(1,1);
|
||||
int titleWidth = 0;
|
||||
int titleHeight = 0;
|
||||
if (m_plotTitle && m_plotTitle->isVisible())
|
||||
{
|
||||
titleWidth = m_plotTitle->width();
|
||||
titleHeight = m_plotTitle->height() + 10;
|
||||
}
|
||||
|
||||
int sumTrackWidth = 0;
|
||||
int maxTrackHeight = 0;
|
||||
for (QPointer<RiuWellLogTrack> track : m_trackPlots)
|
||||
{
|
||||
sumTrackWidth += track->width();
|
||||
maxTrackHeight = std::max(maxTrackHeight, track->height());
|
||||
}
|
||||
return QSize(std::max(titleWidth, sumTrackWidth), titleHeight + maxTrackHeight);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -259,6 +223,14 @@ void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuWellLogPlot::sizeHint() const
|
||||
{
|
||||
return QSize(1, 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -327,7 +299,7 @@ void RiuWellLogPlot::resizeEvent(QResizeEvent *event)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<int, int> RiuWellLogPlot::calculateTrackWidths(int frameWidth)
|
||||
std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWidth) const
|
||||
{
|
||||
int trackCount = m_trackPlots.size();
|
||||
|
||||
@ -341,6 +313,12 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidths(int frameWidth)
|
||||
{
|
||||
firstTrackAxisOffset = static_cast<int>(m_trackPlots[tIdx]->plotLayout()->canvasRect().left());
|
||||
}
|
||||
else if (visibleTrackCount == 1)
|
||||
{
|
||||
// The others axes also have markers, and so we need to subtract for this to get the shift due to labels and title
|
||||
int otherTrackAxisOffset = static_cast<int>(m_trackPlots[tIdx]->plotLayout()->canvasRect().left());
|
||||
firstTrackAxisOffset -= otherTrackAxisOffset;
|
||||
}
|
||||
++visibleTrackCount;
|
||||
}
|
||||
}
|
||||
@ -402,7 +380,7 @@ void RiuWellLogPlot::placeChildWidgets(int frameHeight, int frameWidth)
|
||||
|
||||
const int trackPadding = 4;
|
||||
|
||||
std::map<int, int> trackWidths = calculateTrackWidths(frameWidth);
|
||||
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame(frameWidth);
|
||||
size_t visibleTrackCount = trackWidths.size();
|
||||
|
||||
int maxLegendHeight = 0;
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
void setDepthZoomAndReplot(double minDepth, double maxDepth);
|
||||
void setPlotTitle(const QString& plotTitle);
|
||||
|
||||
virtual QSize preferredSize() const;
|
||||
public slots:
|
||||
void updateChildrenLayout();
|
||||
|
||||
@ -67,13 +67,12 @@ protected:
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
virtual void showEvent(QShowEvent *);
|
||||
virtual void changeEvent(QEvent *);
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
private:
|
||||
void updateScrollBar(double minDepth, double maxDepth);
|
||||
void modifyWidthOfContainingMdiWindow(int widthChange);
|
||||
std::map<int, int> calculateTrackWidths(int frameWidth);
|
||||
std::map<int, int> calculateTrackWidthsToMatchFrame(int frameWidth) const;
|
||||
void placeChildWidgets(int frameHeight, int frameWidth);
|
||||
void positionTitle(int frameWidth);
|
||||
|
||||
|
@ -90,7 +90,7 @@ void RiuWellLogTrack::setDefaults()
|
||||
axisScaleEngine(QwtPlot::xTop)->setAttribute(QwtScaleEngine::Floating, true);
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating, true);
|
||||
setAxisScale(QwtPlot::yLeft, 1000, 0);
|
||||
setAxisScale(QwtPlot::xTop, -10, 100);
|
||||
setXRange(0, 100);
|
||||
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ void RiuWellLogTrack::setAutoTickIntervalCounts(int maxMajorTickIntervalCount, i
|
||||
this->setAxisMaxMinor(QwtPlot::xTop, maxMinorTickIntervalCount);
|
||||
// Reapply axis limits to force Qwt to use the tick settings.
|
||||
QwtInterval currentRange = this->axisInterval(QwtPlot::xTop);
|
||||
this->setAxisScale(QwtPlot::xTop, currentRange.minValue(), currentRange.maxValue());
|
||||
this->setXRange(currentRange.minValue(), currentRange.maxValue());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -77,7 +77,7 @@ RiuWellPltPlot::RiuWellPltPlot(RimWellPltPlot* plotDefinition, QWidget* parent)
|
||||
mainLayout->addLayout(plotWidgetsLayout);
|
||||
plotWidgetsLayout->addLayout(rightColumnLayout);
|
||||
|
||||
QWidget* wellFlowWidget = m_plotDefinition->wellLogPlot()->createViewWidget(this);
|
||||
QWidget* wellFlowWidget = m_plotDefinition->wellLogPlot()->createPlotWidget();
|
||||
|
||||
plotWidgetsLayout->addWidget(wellFlowWidget);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ RiuWellRftPlot::RiuWellRftPlot(RimWellRftPlot* plotDefinition, QWidget* parent)
|
||||
mainLayout->addLayout(plotWidgetsLayout);
|
||||
plotWidgetsLayout->addLayout(rightColumnLayout);
|
||||
|
||||
QWidget* wellFlowWidget = m_plotDefinition->wellLogPlot()->createViewWidget(this);
|
||||
QWidget* wellFlowWidget = m_plotDefinition->wellLogPlot()->createPlotWidget();
|
||||
|
||||
plotWidgetsLayout->addWidget(wellFlowWidget);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user