mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4166 Add feature for swapping cross plot axes + tweaks to legend
* Also put x and y property side by side in property editor
This commit is contained in:
@@ -83,6 +83,41 @@ void RiuGridCrossQwtPlot::removeCurveSetLegend(RimGridCrossPlotCurveSet* curveSe
|
||||
this->updateLegendLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuGridCrossQwtPlot::updateLegendSizesToMatchPlot()
|
||||
{
|
||||
RimGridCrossPlot* crossPlot = dynamic_cast<RimGridCrossPlot*>(ownerPlotDefinition());
|
||||
if (!crossPlot) return;
|
||||
|
||||
bool anyLegendResized = false;
|
||||
|
||||
for (RimGridCrossPlotCurveSet* curveSet : crossPlot->curveSets())
|
||||
{
|
||||
if (!curveSet->isChecked() || !curveSet->legendConfig()->showLegend()) continue;
|
||||
|
||||
auto pairIt = m_legendWidgets.find(curveSet);
|
||||
if (pairIt != m_legendWidgets.end())
|
||||
{
|
||||
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
|
||||
if (overlayWidget->isVisible())
|
||||
{
|
||||
caf::TitledOverlayFrame* overlayItem = curveSet->legendConfig()->titledOverlayFrame();
|
||||
if (resizeOverlayItemToFitPlot(overlayItem))
|
||||
{
|
||||
anyLegendResized = true;
|
||||
overlayWidget->updateFromOverlayItem(overlayItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (anyLegendResized)
|
||||
{
|
||||
updateLegendLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -146,35 +181,7 @@ void RiuGridCrossQwtPlot::updateLegendLayout()
|
||||
void RiuGridCrossQwtPlot::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
QwtPlot::resizeEvent(e);
|
||||
|
||||
RimGridCrossPlot* crossPlot = dynamic_cast<RimGridCrossPlot*>(ownerPlotDefinition());
|
||||
if (!crossPlot) return;
|
||||
|
||||
bool anyLegendResized = false;
|
||||
|
||||
for (RimGridCrossPlotCurveSet* curveSet : crossPlot->curveSets())
|
||||
{
|
||||
if (!curveSet->isChecked() || !curveSet->legendConfig()->showLegend()) continue;
|
||||
|
||||
auto pairIt = m_legendWidgets.find(curveSet);
|
||||
if (pairIt != m_legendWidgets.end())
|
||||
{
|
||||
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
|
||||
if (overlayWidget->isVisible())
|
||||
{
|
||||
caf::TitledOverlayFrame* overlayItem = curveSet->legendConfig()->titledOverlayFrame();
|
||||
if (resizeOverlayItemToFitPlot(overlayItem))
|
||||
{
|
||||
anyLegendResized = true;
|
||||
overlayWidget->updateFromOverlayItem(overlayItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (anyLegendResized)
|
||||
{
|
||||
updateLegendLayout();
|
||||
}
|
||||
updateLegendSizesToMatchPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user