[Qt-interest] Difference between QImage and QWidget when drawing a dotted line
Samuel Rødal
samuel.rodal at nokia.com
Thu Aug 12 15:57:59 CEST 2010
On 08/05/2010 02:14 PM, ext Ronny Brendel wrote:
> Hi,
>
> I have come across a imo weird behavior.
> When drawing a dotted line on a QImage, the length of a dot is one pixel.
> When in turn drawing on a widget directly the dots have a length of two pixels.
>
> Why is that?
>
> For me it is an inconvenience, because I have to introduce a (not needed)
> qimage in order to achieve similar looks.
>
> Or am I missing something?
>
> Here's an image with both looks of the same painting commands
> http://a.imageshack.us/img375/5499/commitment1.png
>
> ps: please put me on the cc (or reply-all) since I am not subscribed to the
> list.
>
> regards
> Ronny
Different paint engines might be used depending on the platform. For
QImage the raster paint engine is used, and that is also the default
widget paint engine on Windows. On Linux the X11 paint engine is used
for pixmaps and widgets, and on mac the core graphics paint engine is used.
For some painting operations where we use the native APIs to paint we
don't get the exact same behaviour on all platforms like in this case.
We're hoping in the future to reduce the number of paint engines and use
raster as the default on linux and mac too. In the mean-time you can run
your application with -graphicssystem raster or do
QApplication::setGraphicsSystem("raster"); before creating the
QApplication object. Note that the raster graphics system is not that
stable on mac yet.
--
Samuel
More information about the Qt-interest-old
mailing list