mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 23:46:00 -06:00
#8949 Plot Update: Improve visual stability when clicking on curves
adjustSize() causes the plot to resize twice which is annoying. Cache the last child count to avoid calls to adjustSize().
This commit is contained in:
parent
fe1acc93a6
commit
c199f960e3
@ -226,6 +226,8 @@ void RiuMultiPlotPage::removePlot( RiuPlotWidget* plotWidget )
|
||||
m_subTitles.removeAt( plotWidgetIdx );
|
||||
delete subTitle;
|
||||
|
||||
m_childCountForAdjustSizeOperation.clear();
|
||||
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
@ -733,9 +735,23 @@ int RiuMultiPlotPage::alignCanvasTops()
|
||||
{
|
||||
int row = visibleIndex / rowAndColumnCount.second;
|
||||
qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtAxis::XTop )->setMinimumExtent( maxExtents[row] );
|
||||
if ( legends[visibleIndex] )
|
||||
auto legend = legends[visibleIndex];
|
||||
if ( legend )
|
||||
{
|
||||
legends[visibleIndex]->adjustSize();
|
||||
int previousChildCount = -1;
|
||||
|
||||
auto it = m_childCountForAdjustSizeOperation.find( legend );
|
||||
if ( it != m_childCountForAdjustSizeOperation.end() )
|
||||
{
|
||||
previousChildCount = it->second;
|
||||
}
|
||||
|
||||
auto legendItemCount = legend->contentsWidget()->children().size();
|
||||
if ( previousChildCount != legendItemCount )
|
||||
{
|
||||
legends[visibleIndex]->adjustSize();
|
||||
m_childCountForAdjustSizeOperation[legend] = legendItemCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +147,8 @@ protected:
|
||||
bool m_previewMode;
|
||||
bool m_showSubTitles;
|
||||
|
||||
std::map<RiuQwtPlotLegend*, int> m_childCountForAdjustSizeOperation;
|
||||
|
||||
private:
|
||||
friend class RiaPlotWindowRedrawScheduler;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user