mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-13 08:52:14 -05:00
#4128 Show Qwt symbol and color as icon in project tree
This commit is contained in:
1 parent
7866122b31
commit
39a0c3f4d0
6 files changed
+22
-15
No files matched your search
@@ -225,7 +225,6 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
|
|||||||
updateAllRequiredEditors();
|
updateAllRequiredEditors();
|
||||||
updatePlot();
|
updatePlot();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "RiaColorTables.h"
|
#include "RiaColorTables.h"
|
||||||
|
|
||||||
#include "RigCaseCellResultCalculator.h"
|
#include "RigCaseCellResultCalculator.h"
|
||||||
|
#include "RiuQwtSymbol.h"
|
||||||
|
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
|
|
||||||
#include "qwt_plot.h"
|
#include "qwt_plot.h"
|
||||||
#include "qwt_plot_curve.h"
|
#include "qwt_plot_curve.h"
|
||||||
|
#include "qwt_graphic.h"
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
@@ -77,7 +79,6 @@ RimGridCrossPlotCurve::RimGridCrossPlotCurve()
|
|||||||
CAF_PDM_InitObject("Cross Plot Points", ":/WellLogCurve16x16.png", "", "");
|
CAF_PDM_InitObject("Cross Plot Points", ":/WellLogCurve16x16.png", "", "");
|
||||||
|
|
||||||
setLineStyle(RiuQwtPlotCurve::STYLE_NONE);
|
setLineStyle(RiuQwtPlotCurve::STYLE_NONE);
|
||||||
setLineThickness(0);
|
|
||||||
setSymbol(RiuQwtSymbol::SYMBOL_NONE);
|
setSymbol(RiuQwtSymbol::SYMBOL_NONE);
|
||||||
setSymbolSize(6);
|
setSymbolSize(6);
|
||||||
}
|
}
|
||||||
@@ -137,13 +138,3 @@ void RimGridCrossPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
|||||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
||||||
RimPlotCurve::appearanceUiOrdering(*appearanceGroup);
|
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;
|
QString createCurveAutoName() override;
|
||||||
void onLoadDataAndUpdate(bool updateParentPlot) override;
|
void onLoadDataAndUpdate(bool updateParentPlot) override;
|
||||||
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) 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->setSamples(sampleCategory.second);
|
||||||
curve->updateCurveAppearance();
|
curve->updateCurveAppearance();
|
||||||
curve->updateCurveNameAndUpdatePlotLegendAndTitle();
|
curve->updateCurveNameAndUpdatePlotLegendAndTitle();
|
||||||
|
curve->updateUiIconFromPlotSymbol();
|
||||||
|
|
||||||
m_crossPlotCurves.push_back(curve);
|
m_crossPlotCurves.push_back(curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -454,6 +454,22 @@ void RimPlotCurve::curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering)
|
|||||||
uiOrdering.add(&m_curveName);
|
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.
|
// Make sure the legend lines are long enough to distinguish between line types.
|
||||||
// Standard width in Qwt is 8 which is too short.
|
// Standard width in Qwt is 8 which is too short.
|
||||||
// Use 10 and scale this by curve thickness + add space for displaying symbol.
|
// 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();
|
QSize legendIconSize = m_qwtPlotCurve->legendIconSize();
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public:
|
|||||||
|
|
||||||
virtual void updateCurveAppearance();
|
virtual void updateCurveAppearance();
|
||||||
bool isCrossPlotCurve() const;
|
bool isCrossPlotCurve() const;
|
||||||
|
void updateUiIconFromPlotSymbol();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -110,7 +111,6 @@ protected:
|
|||||||
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
|
||||||
void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
void appearanceUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
||||||
void curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
void curveNameUiOrdering(caf::PdmUiOrdering& uiOrdering);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool canCurveBeAttached() const;
|
bool canCurveBeAttached() const;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user