When you work around it in your code and don't tell me what went wrong I can't fix it in the lib.
The printer sent with QPrintPreviewDialog::paintRequested(), returns QPaintEngine::Picture for paintEngine()->type().
This was the workaround I used:
void PlotTextLabel
::draw( QPainter *painter,
const QRectF &canvasRect
) const {
if (painter
->paintEngine
()->type
() == QPaintEngine::Picture) { const int m = margin();
const QRectF rect
= textRect
( canvasRect.
adjusted( m, m,
-m,
-m
),
text().textSize( painter->font() ) );
text().draw(painter, rect);
} else {
QwtPlotTextLabel::draw(painter, xMap, yMap, canvasRect);
}
}
void PlotTextLabel::draw( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect ) const
{
if (painter->paintEngine()->type() == QPaintEngine::Picture) {
const int m = margin();
const QRectF rect = textRect( canvasRect.adjusted( m, m, -m, -m ),
text().textSize( painter->font() ) );
text().draw(painter, rect);
} else {
QwtPlotTextLabel::draw(painter, xMap, yMap, canvasRect);
}
}
To copy to clipboard, switch view to plain text mode
This would have worked, but may have some side-effects.
{
if ( painter && painter->isActive() )
{
switch ( painter->paintEngine()->type() )
{
return false;
default:;
}
const QTransform tr = painter->transform();
if ( tr.isRotating() || tr.isScaling() )
{
return false;
}
}
return true;
}
bool QwtPainter::isAligning( QPainter *painter )
{
if ( painter && painter->isActive() )
{
switch ( painter->paintEngine()->type() )
{
case QPaintEngine::Pdf:
case QPaintEngine::SVG:
case QPaintEngine::Picture: // <- Here
return false;
default:;
}
const QTransform tr = painter->transform();
if ( tr.isRotating() || tr.isScaling() )
{
return false;
}
}
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks