I am having a miserable time trying to understand how coordinate systems work in the Graphics / View architecture. I've read everything I can find, but none of the examples seem to apply to my situation.

For discussion purposes, assume I have objects that I want to represent as QGraphicsItem instances. These items have world-based coordinates in centimeters. I want to draw them (in the QGraphicsItem :: paint method) using their centimeter dimensions.

I want to put them in a scene that has dimensions in meters (or feet, or miles, or anything else except cm). For argument's sake, say the scene has a scene rect 3 m square.

So if I have an object that is a square 100 cm x 100 cm, in its paint() method I call

Qt Code:
  1. painter->drawRect( QRectF( 0, 0, 100, 100 ) );
To copy to clipboard, switch view to plain text mode 

In my view, I get a rectangle 100 *pixels* square, no matter what I try to do with transforms, scaling, or anything else in the scene to map from item to scene coordinates.

Every example I have seen appears to use pixel coordinates everywhere (view, scene, items), with no examples on how to properly use transformations.

Can anyone point me to source code for a non-trivial Graphics / View application that uses world coordinates for items, with proper mapping to scene and view? I am thinking that something like a CAD or scientific plotting application would show me what I need to do.

Thanks in advance for any help.