Code: Select all
void SurfaceImpl::DrawTextNoClip( PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
ColourRGBA fore,
ColourRGBA back )
{
Q_UNUSED( ybase )
SetFont( font );
PenColour( fore );
GetPainter()->setBackground( QColorFromColourRGBA( back ) );
GetPainter()->setBackgroundMode( Qt::OpaqueMode );
QString su = UnicodeFromText( codec, text );
GetPainter()->drawText( QPointF( rc.left, ybase ), su );
//GetPainter()->drawText( QRectFFromPRect( rc ), su );
// stop random background bleed over
GetPainter()->setBackgroundMode( Qt::TransparentMode );
}
This method will "randomly" use the previous brush and background color
Code: Select all
void SurfaceImpl::DrawTextTransparent( PRectangle rc,
const Font *font,
XYPOSITION ybase,
std::string_view text,
ColourRGBA fore )
{
GetPainter()->setBrush( Qt::NoBrush );
SetFont( font );
PenColour( fore );
GetPainter()->setBackgroundMode( Qt::TransparentMode );
QString su = UnicodeFromText( codec, text );
GetPainter()->drawText( QPointF( rc.left, ybase ), su );
}
Code: Select all
QPainter *SurfaceImpl::GetPainter()
{
Q_ASSERT( device );
if ( !painter )
{
if ( device->paintingActive() )
{
painter = device->paintEngine()->painter();
}
else
{
painterOwned = true;
painter = new QPainter( device );
}
// Set text antialiasing unconditionally.
// The font's style strategy will override.
painter->setRenderHint( QPainter::TextAntialiasing, true );
painter->setRenderHint( QPainter::Antialiasing, true );
}
return painter;
}
https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/11/scintilla-prev-1-1.png
Sometimes multiple pages in a row, other times just one page and then fine again for many pages. Seems to happen more often after a break caused by FF in file.
It's seems like, once you have turned on Opaque, going back to transparent and throwing away the brush is merely a suggestion.

OH!
This only happens when the paint device is the widget inside of the QPrintPreviewDialog. Physically printed to printer and physically displayed to a primary widget all is well. This problem may be caused by or in QPrintPreviewWidget.