Are you talking about shifting the position of a marker label, when it comes to close to the canvas border ?
Uwe
Are you talking about shifting the position of a marker label, when it comes to close to the canvas border ?
Uwe
Hi Uwe!
I want to initialise a QwtPlotMarker by a QwtText wich has border ( the border pen has been set).
I would like to see a margin between the text and the borderline when I shows this QwtPlotMarker. But now the border are close to the border.
Is there any way to draw margin in a QwtText?
QwtPlotMarker* m_pDescription;
QwtText m_descriptionText;
...
m_pDescription = new QwtPlotMarker();
m_pDescription->attach( ui->pltCurve ); // This is the QwtPlot
...
QPen tmpPen = m_descriptionText.borderPen();
tmpPen.setStyle( Qt::SolidLine );
tmpPen.setWidth( 1 );
m_descriptionText.setBorderPen(tmpPen);
...
m_pDescription->setValue( pos ); // Where pos is a QPosF
m_descriptionText.setText( txt ); // Where txt is a QString
m_pDescription->setLabel( m_descriptionText );
m_pDescription->show();
m_pDescription->setLabel( m_descriptionText );
Sorry, but my english not very good.
Thanks for your help!
KoVi
In general a QwtText is painted using QwtText::drawText( QPainter *, const QRectF &). So what you can do is to overload QwtPlotMarker::drawLabel() calculating a different ( = larger ) rectangle.
Uwe
Hi!
Is it possible to add a custom margin between QwtText's inner border and the text itself?
Otherwise it looks quite ugly when borderPen and borderRadius are defined.
I mean something like QwtText::setInnerMargin(2) for example.
Thanks!
All you can do is the derive from QwtTextEngine overloading QwtTextEngine::textMargins, register it with QwtText::setTextEngine and use this special engine for the texts, where you need the extra margins.
Of course this is only a workaround and there should be something like QwtText::setInnerMargin().
Uwe
Bookmarks