Originally Posted by
d_stranz
Your code does not pass a pointer to a QwtSymbol, it passes a reference.
yes. That is the correct way to do it. I never said that I wanted to pass a pointer. I said to patrik that he passed a pointer in his code (which is edited now).
Originally Posted by
d_stranz
Furthermore, your code does not allow setting a symbol size, as Patrik noted, since you have no way to access the reference once the setSymbol() call returns.
//...
symbol.setSize(Qsize(5,5));
curve->setSymbol(symbol);
curve->setSymbol(QwtSymbol(QwtSymbol::Rect));
//...
QwtSymbol symbol = myCurve->symbol();
symbol.setSize(Qsize(5,5));
curve->setSymbol(symbol);
To copy to clipboard, switch view to plain text mode
Originally Posted by
d_stranz
So for completeness, my code should be updated to read something like this:
symbol.
setSize( QSize( 5,
5) );
myCurve->setSymbol( symbol );
QwtSymbol symbol( QwtSymbol::Rect );
symbol.setSize( QSize( 5, 5) );
myCurve->setSymbol( symbol );
To copy to clipboard, switch view to plain text mode
I'd suggest
myCurve->setSymbol(QwtSymbol ( QwtSymbol::Rect , QBrush(myCurve->pen().color()), QPen(myCurve->pen().color()), QSize(5,5)));
To copy to clipboard, switch view to plain text mode
Bookmarks