mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
First round of caf::FontTools
This commit is contained in:
@@ -449,7 +449,7 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
{
|
||||
caf::PdmUiGroup* selVectorsGrp = uiOrdering.addNewGroup( "Selected Vectors" );
|
||||
selVectorsGrp->add( &m_selectedVarsUiField );
|
||||
selVectorsGrp->add( &m_selectVariablesButtonField, {false} );
|
||||
selVectorsGrp->add( &m_selectVariablesButtonField, { false } );
|
||||
|
||||
QString vectorNames;
|
||||
if ( m_analyserOfSelectedCurveDefs )
|
||||
@@ -471,14 +471,14 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
timeStepGrp->add( &m_addTimestepUiField );
|
||||
timeStepGrp->add( &m_selectedTimeSteps );
|
||||
|
||||
uiOrdering.add( &m_referenceCase, {true, 3, 2} );
|
||||
uiOrdering.add( &m_referenceCase, { true, 3, 2 } );
|
||||
|
||||
uiOrdering.add( &m_showPlotTitle );
|
||||
uiOrdering.add( &m_useAutoPlotTitle, {false} );
|
||||
uiOrdering.add( &m_description, {false} );
|
||||
uiOrdering.add( &m_useAutoPlotTitle, { false } );
|
||||
uiOrdering.add( &m_description, { false } );
|
||||
m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle() );
|
||||
|
||||
uiOrdering.add( &m_barOrientation, {true, 3, 2} );
|
||||
uiOrdering.add( &m_barOrientation, { true, 3, 2 } );
|
||||
|
||||
caf::PdmUiGroup* sortGrp = uiOrdering.addNewGroup( "Sorting and Grouping" );
|
||||
sortGrp->add( &m_majorGroupType );
|
||||
@@ -486,7 +486,7 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
sortGrp->add( &m_minorGroupType );
|
||||
sortGrp->add( &m_valueSortOperation );
|
||||
sortGrp->add( &m_useTopBarsFilter );
|
||||
sortGrp->add( &m_maxBarCount, {false} );
|
||||
sortGrp->add( &m_maxBarCount, { false } );
|
||||
m_maxBarCount.uiCapability()->setUiReadOnly( !m_useTopBarsFilter() );
|
||||
|
||||
caf::PdmUiGroup* legendGrp = uiOrdering.addNewGroup( "Legend" );
|
||||
@@ -499,10 +499,10 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
caf::PdmUiGroup* barLabelGrp = uiOrdering.addNewGroup( "Bar Labels" );
|
||||
barLabelGrp->add( &m_useBarText );
|
||||
barLabelGrp->add( &m_useQuantityInBarText );
|
||||
barLabelGrp->add( &m_useSummaryItemInBarText, {false} );
|
||||
barLabelGrp->add( &m_useSummaryItemInBarText, { false } );
|
||||
barLabelGrp->add( &m_useCaseInBarText );
|
||||
barLabelGrp->add( &m_useEnsembleInBarText, {false} );
|
||||
barLabelGrp->add( &m_useTimeStepInBarText, {true, 4, 1} );
|
||||
barLabelGrp->add( &m_useEnsembleInBarText, { false } );
|
||||
barLabelGrp->add( &m_useTimeStepInBarText, { true, 4, 1 } );
|
||||
|
||||
m_useQuantityInBarText.uiCapability()->setUiReadOnly( !m_useBarText );
|
||||
m_useSummaryItemInBarText.uiCapability()->setUiReadOnly( !m_useBarText );
|
||||
@@ -556,16 +556,16 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
|
||||
if ( fieldNeedingOptions == &m_addTimestepUiField )
|
||||
{
|
||||
options.push_back( {"None", QDateTime()} );
|
||||
options.push_back( { "None", QDateTime() } );
|
||||
|
||||
std::set<time_t> timeStepUnion = allAvailableTimeSteps();
|
||||
|
||||
for ( time_t timeT : timeStepUnion )
|
||||
{
|
||||
QDateTime dateTime = RiaQDateTimeTools::fromTime_t( timeT );
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( {dateTime} );
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( { dateTime } );
|
||||
|
||||
options.push_back( {dateTime.toString( formatString ), dateTime} );
|
||||
options.push_back( { dateTime.toString( formatString ), dateTime } );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_valueSortOperation )
|
||||
@@ -588,7 +588,7 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
{
|
||||
std::vector<RimSummaryCase*> allSummaryCases = RimProject::current()->allSummaryCases();
|
||||
|
||||
options.push_back( {"None", nullptr} );
|
||||
options.push_back( { "None", nullptr } );
|
||||
|
||||
for ( auto sumCase : allSummaryCases )
|
||||
{
|
||||
@@ -599,7 +599,7 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
displayName = caseColl->name() + "/" + displayName;
|
||||
}
|
||||
|
||||
options.push_back( {displayName, sumCase} );
|
||||
options.push_back( { displayName, sumCase } );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
m_plotWidget->insertLegend( nullptr );
|
||||
}
|
||||
|
||||
m_plotWidget->setLegendFontSize( m_legendFontSize() );
|
||||
m_plotWidget->setLegendFontSize( legendFontSize() );
|
||||
m_plotWidget->updateLegend();
|
||||
}
|
||||
|
||||
@@ -720,43 +720,6 @@ QImage RimAnalysisPlot::snapshotWindowContent()
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimAnalysisPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange /*= false */ )
|
||||
{
|
||||
bool anyChange = false;
|
||||
|
||||
if ( fontSettingType == RiaDefines::FontSettingType::PLOT_FONT && m_plotWidget )
|
||||
{
|
||||
for ( auto plotAxis : allPlotAxes() )
|
||||
{
|
||||
if ( forceChange || plotAxis->titleFontSize() == oldFontSize )
|
||||
{
|
||||
plotAxis->setTitleFontSize( fontSize );
|
||||
anyChange = true;
|
||||
}
|
||||
if ( forceChange || plotAxis->valuesFontSize() == oldFontSize )
|
||||
{
|
||||
plotAxis->setValuesFontSize( fontSize );
|
||||
anyChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( forceChange || m_legendFontSize() == oldFontSize )
|
||||
{
|
||||
m_legendFontSize = fontSize;
|
||||
anyChange = true;
|
||||
}
|
||||
|
||||
if ( anyChange ) loadDataAndUpdate();
|
||||
}
|
||||
return anyChange;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1071,7 +1034,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
|
||||
|
||||
auto itIsInsertedPair = casesToKeepWithValue.insert( {sumCase, value} );
|
||||
auto itIsInsertedPair = casesToKeepWithValue.insert( { sumCase, value } );
|
||||
if ( !itIsInsertedPair.second ) // Already exists in map
|
||||
{
|
||||
double& insertedValue = itIsInsertedPair.first->second;
|
||||
@@ -1165,7 +1128,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
if ( historyTimesteps.size() )
|
||||
{
|
||||
selectedTimestepIndices =
|
||||
RimAnalysisPlot::findTimestepIndices( {historyTimesteps.back()}, timesteps );
|
||||
RimAnalysisPlot::findTimestepIndices( { historyTimesteps.back() }, timesteps );
|
||||
}
|
||||
}
|
||||
else if ( filter->consideredTimeStepsType() == RimPlotDataFilterItem::SELECT_TIMESTEP_RANGE )
|
||||
@@ -1223,7 +1186,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
|
||||
|
||||
auto itIsInsertedPair = casesToKeepWithValue.insert( {sumCaseInEvaluation, value} );
|
||||
auto itIsInsertedPair = casesToKeepWithValue.insert( { sumCaseInEvaluation, value } );
|
||||
if ( !itIsInsertedPair.second ) // Already exists in map
|
||||
{
|
||||
double& insertedValue = itIsInsertedPair.first->second;
|
||||
@@ -1277,7 +1240,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
if ( filter->useAbsoluteValues() ) value = fabs( value );
|
||||
bool useLargest = filter->filterOperation() == RimPlotDataFilterItem::TOP_N;
|
||||
|
||||
auto itIsInsertedPair = sumItemsToKeepWithValue.insert( {sumItem, value} );
|
||||
auto itIsInsertedPair = sumItemsToKeepWithValue.insert( { sumItem, value } );
|
||||
if ( !itIsInsertedPair.second ) // Already exists in map
|
||||
{
|
||||
double& insertedValue = itIsInsertedPair.first->second;
|
||||
@@ -1305,7 +1268,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::multimap<double, RifEclipseSummaryAddress> valueSortedSumItems;
|
||||
for ( const auto& itemValPair : sumItemsToKeepWithValue )
|
||||
{
|
||||
valueSortedSumItems.insert( {itemValPair.second, itemValPair.first} );
|
||||
valueSortedSumItems.insert( { itemValPair.second, itemValPair.first } );
|
||||
}
|
||||
|
||||
if ( filter->filterOperation() == RimPlotDataFilterItem::TOP_N )
|
||||
@@ -1336,7 +1299,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::multimap<double, RimSummaryCase*> valueSortedSumCases;
|
||||
for ( const auto& caseValPair : casesToKeepWithValue )
|
||||
{
|
||||
valueSortedSumCases.insert( {caseValPair.second, caseValPair.first} );
|
||||
valueSortedSumCases.insert( { caseValPair.second, caseValPair.first } );
|
||||
}
|
||||
|
||||
if ( filter->filterOperation() == RimPlotDataFilterItem::TOP_N )
|
||||
@@ -1448,7 +1411,7 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
double sortValue = std::numeric_limits<double>::infinity();
|
||||
|
||||
QDateTime dateTime = RiaQDateTimeTools::fromTime_t( timesteps[timestepIdx] );
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( {dateTime} );
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( { dateTime } );
|
||||
|
||||
QString timestepString = dateTime.toString( formatString );
|
||||
|
||||
@@ -1554,7 +1517,7 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += " @ ";
|
||||
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( {m_selectedTimeSteps()[0]} );
|
||||
QString formatString = RiaQDateTimeTools::createTimeFormatStringFromDates( { m_selectedTimeSteps()[0] } );
|
||||
autoTitle += m_selectedTimeSteps()[0].toString( formatString );
|
||||
}
|
||||
|
||||
@@ -1629,7 +1592,7 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitionsWithEmbe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimPlotAxisPropertiesInterface*> RimAnalysisPlot::allPlotAxes() const
|
||||
{
|
||||
return {m_valueAxisProperties};
|
||||
return { m_valueAxisProperties };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -115,10 +115,6 @@ private:
|
||||
void onLoadDataAndUpdate() override;
|
||||
void zoomAll() override {}
|
||||
QImage snapshotWindowContent() override;
|
||||
bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
|
||||
int oldFontSize,
|
||||
int fontSize,
|
||||
bool forceChange = false ) override;
|
||||
|
||||
// RimPlotWindow overrides
|
||||
|
||||
|
||||
Reference in New Issue
Block a user