mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4128 Show Qwt symbol and color as icon in project tree
This commit is contained in:
parent
7866122b31
commit
39a0c3f4d0
@ -225,7 +225,6 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
|
||||
updateAllRequiredEditors();
|
||||
updatePlot();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RigCaseCellResultCalculator.h"
|
||||
#include "RiuQwtSymbol.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
@ -35,6 +36,7 @@
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
#include "qwt_graphic.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
@ -77,7 +79,6 @@ RimGridCrossPlotCurve::RimGridCrossPlotCurve()
|
||||
CAF_PDM_InitObject("Cross Plot Points", ":/WellLogCurve16x16.png", "", "");
|
||||
|
||||
setLineStyle(RiuQwtPlotCurve::STYLE_NONE);
|
||||
setLineThickness(0);
|
||||
setSymbol(RiuQwtSymbol::SYMBOL_NONE);
|
||||
setSymbolSize(6);
|
||||
}
|
||||
@ -137,13 +138,3 @@ void RimGridCrossPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
||||
RimPlotCurve::appearanceUiOrdering(*appearanceGroup);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimGridCrossPlotCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
return options;
|
||||
}
|
||||
|
@ -49,6 +49,5 @@ protected:
|
||||
QString createCurveAutoName() override;
|
||||
void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
};
|
||||
|
||||
|
@ -288,6 +288,8 @@ void RimGridCrossPlotCurveSet::onLoadDataAndUpdate(bool updateParentPlot)
|
||||
curve->setSamples(sampleCategory.second);
|
||||
curve->updateCurveAppearance();
|
||||
curve->updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||
curve->updateUiIconFromPlotSymbol();
|
||||
|
||||
m_crossPlotCurves.push_back(curve);
|
||||
}
|
||||
|
||||
|
@ -454,6 +454,22 @@ void RimPlotCurve::curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
||||
uiOrdering.add(&m_curveName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::updateUiIconFromPlotSymbol()
|
||||
{
|
||||
if (m_pointSymbol() != RiuQwtSymbol::NoSymbol)
|
||||
{
|
||||
QColor curveColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
||||
|
||||
QSizeF iconSize(24, 24);
|
||||
QwtGraphic graphic = m_qwtPlotCurve->legendIcon(0, iconSize);
|
||||
QPixmap pixmap = graphic.toPixmap();
|
||||
setUiIcon(QIcon(pixmap));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -512,7 +528,7 @@ void RimPlotCurve::updateCurveAppearance()
|
||||
// Make sure the legend lines are long enough to distinguish between line types.
|
||||
// Standard width in Qwt is 8 which is too short.
|
||||
// Use 10 and scale this by curve thickness + add space for displaying symbol.
|
||||
if (m_curveThickness() > 0)
|
||||
if (m_lineStyle() != RiuQwtPlotCurve::STYLE_NONE)
|
||||
{
|
||||
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
|
||||
virtual void updateCurveAppearance();
|
||||
bool isCrossPlotCurve() const;
|
||||
void updateUiIconFromPlotSymbol();
|
||||
|
||||
protected:
|
||||
|
||||
@ -110,7 +111,6 @@ protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||
void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
||||
void curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
||||
|
||||
private:
|
||||
bool canCurveBeAttached() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user