January 3, 2012

Asperamanca Asperamanca
Robot Herder
722 posts

SOLVED: Pattern BrushStyle drawn “spotty” or incomplete

 

I am using the Qt::VerPattern when painting rectangles. Sometimes, they look fine, but often, they are spotty, incomplete or altogether missing.

The area encircled in red contains 11 rectangles, some drawn with a solid pattern, some with a VerPattern.

This is not an issue of the rectangles being too small for the pattern to paint properly – I’ve been through this before, and knew I had to look for it.
Also, rectangles painted with the solid pattern are always correct. Therefore, the issue lies with the pattern, not the rectangle coordinates.

When you consider the rectangle right below the text “09:50:10”, it’s a single rectangle, but as you see, there are vertical lines missing.

The brush I use is

  1. QBrush(QColor(ARGB 1, 0.788235, 0.788235, 0.788235) , VerPattern )

The rectangle I paint is
  1. QRectF(31672,3 4312x14)

(Note: I am using a transformation on the x-axis. The x-coordinates are given in milliseconds from the left edge of the display. You can check the width of the rectangle of 4312 ms against the scale displayed above, and the width matches).

Any ideas what’s wrong here?

1 reply

January 3, 2012

Asperamanca Asperamanca
Robot Herder
722 posts

Seems that brush patterns don’t work very well with transformations…or the docs simply don’t mention how transformations affect brush patterns.

Leaving the painter in its original transform, and mapping the rectangles myself does the trick.

 
  ‹‹ QRegExp for everything inside [ ]      [Solved] Releasing memory ››

You must log in to post a reply. Not a member yet? Register here!