AnnaP
2nd February 2011, 14:15
Hello all,
I faced with a problem that using QwtPlotCurve::LegendShowSymbol doesn't show a symbol (a circle in my case) in a legend entirely:
5860
Here is an example code:
class TestPlot: public QwtPlot
{
public:
TestPlot(QWidget * parent = NULL);
private:
QwtPlotCurve _curve;
};
TestPlot::TestPlot(QWidget * parent) : QwtPlot(parent)
{
QwtSymbol *sym = new QwtSymbol(QwtSymbol::Ellipse);
sym->setSize(5);
sym->setPen(QColor(Qt::blue));
_curve.setSymbol(sym);
_curve.setStyle(QwtPlotCurve::NoCurve);
_curve.setTitle(tr ("Curve"));
_curve.setLegendAttribute(QwtPlotCurve::LegendShow Symbol);
_curve.attach(this);
QVector <double> x;
for (unsigned i = 0; i < 10; ++i)
{
x.push_back(i);
}
_curve.setSamples(x, x);
QwtLegend *legend = new QwtLegend(this);
insertLegend(legend, QwtPlot::BottomLegend);
}
If I change a symbol size from 5 to 10 everything looks nice:
5861
Does anybody know why this can happen?
Thanks for any help!
I faced with a problem that using QwtPlotCurve::LegendShowSymbol doesn't show a symbol (a circle in my case) in a legend entirely:
5860
Here is an example code:
class TestPlot: public QwtPlot
{
public:
TestPlot(QWidget * parent = NULL);
private:
QwtPlotCurve _curve;
};
TestPlot::TestPlot(QWidget * parent) : QwtPlot(parent)
{
QwtSymbol *sym = new QwtSymbol(QwtSymbol::Ellipse);
sym->setSize(5);
sym->setPen(QColor(Qt::blue));
_curve.setSymbol(sym);
_curve.setStyle(QwtPlotCurve::NoCurve);
_curve.setTitle(tr ("Curve"));
_curve.setLegendAttribute(QwtPlotCurve::LegendShow Symbol);
_curve.attach(this);
QVector <double> x;
for (unsigned i = 0; i < 10; ++i)
{
x.push_back(i);
}
_curve.setSamples(x, x);
QwtLegend *legend = new QwtLegend(this);
insertLegend(legend, QwtPlot::BottomLegend);
}
If I change a symbol size from 5 to 10 everything looks nice:
5861
Does anybody know why this can happen?
Thanks for any help!