I want axis labels for a plot I\'m making, and naturally the y-axis label should be oriented vertically. I\'m pretty sure QwtPlot
does this, but I\'m trying to
So indeed I gave up on finding any simple way to achieve this, and looking over Uwe Rathmann's Qwt code indeed he uses QPainter::drawText()
in his QwtPainter::drawText
wrapper function, and a QTransform
to achieve the rotation, in QwtScaleDraw::labelTransformation
. So I've just put these together as follows:
void LabelWidget::paintEvent(QPaintEvent*)
{
QPainter painter(this);
painter.setPen(Qt::black);
//... Need an appropriate call to painter.translate() for this to work properly
painter.rotate(90);
painter.drawText(QPoint(0,0), _text);
}
Didn't need a QPixmap, it turns out.