
Originally Posted by
carhun
I have for example three point where I want to display my markers:
(2, 5), (4,5), (10,5).
The plot coordinates of the markers are of no importance - what you need are widget coordinates, f.e what you get when overloading QwtPlotMarker::drawLabel.
virtual void YourMarker
::drawLabel( QPainter *painter,
{
const QSizeF labelSize
= label
().
size( painter
->font
() );
const QRectF rect
= labelGeometry
( pos, labelSize
);
label().draw( painter, rect );
}
virtual void YourMarker::drawLabel( QPainter *painter,
const QRectF &canvasRect, const QPointF &pos ) const
{
const QSizeF labelSize = label().size( painter->font() );
const QRectF rect = labelGeometry( pos, labelSize );
label().draw( painter, rect );
}
To copy to clipboard, switch view to plain text mode
Of course the problem now is how to implement YourMarker::labelGeometry(). A conflict resolution ( = avoid overlapping of marker labels ) needs to know position and size in widget coordinates of all markers.
Uwe
Bookmarks