Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.2
-
None
-
Windows 7 64bit, Qt 4.7.2, intel core i5 - 6gb ram,
-
b0a6c521ab85ef13ffd39e6502d6ab45dda25d7f
Description
When I use a bitmap as a texture pattern, the background is not correctly displayed. When you use a build-in pattern, this is done correctly.
Here is some code to reproduce the problem:
Example
QBitmap bitmap("debug/test.png"); QBrush brushBitmap(bitmap); QRect rect(80,0,160,100); QRect rect1(0,10,150,510); QRect rect2(160,10,150,510); painter.setBackgroundMode( Qt::OpaqueMode ); // Qt::OpaqueMode / Qt::TransparentMode painter.setBackground(QColor(0,255,0)); // Background set to green painter.setPen(QPen(Qt::black, 1, Qt::SolidLine)); painter.fillRect(rect,QBrush(Qt::red)); painter.setBrush( brushBitmap ); painter.drawRect(rect1); painter.setBrush(QBrush(Qt::black, Qt::BDiagPattern)); painter.drawRect(rect2);
I think the bug is located in the $QTDIR\src\gui\painting\qemulationpaintengine.cpp: 83
Bug
void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { QPainterState *s = state(); if (s->bgMode == Qt::OpaqueMode) { Qt::BrushStyle style = brush.style(); if (style >= Qt::Dense1Pattern && style <= Qt::DiagCrossPattern) real_engine->fill(path, s->bgBrush); } .... }
should be
BugFIX
void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { QPainterState *s = state(); if (s->bgMode == Qt::OpaqueMode) { Qt::BrushStyle style = brush.style(); if ((style >= Qt::Dense1Pattern && style <= Qt::DiagCrossPattern) || (style == Qt::TexturePattern )) real_engine->fill(path, s->bgBrush); } .... }
I'm Not experienced enough to know if this is the only change needed to solve the problem. But it solved my case.