[Qt-interest] best way set a background photo for a QGraphicsView?

Raul Metsma raul at innovaatik.ee
Thu Apr 15 10:33:27 CEST 2010


Another way is subclassing QGraphicsScene
void QGraphicsScene::drawBackground ( QPainter * painter, const QRectF & 
rect )   [virtual protected]

Raul Metsma

On 04/15/2010 10:14 AM, nobodyhere wrote:
> @Jason, Ross: I agree; thank you for the help
>
> ----- Original Message -----
> From: "Jason H"<scorp1us at yahoo.com>
> To: "nobodyhere"<pem.accounts.spam at gmail.com>, "qt-interest"<qt-interest at trolltech.com>
> Sent: Wednesday, April 14, 2010 9:04:30 AM GMT -06:00 US/Canada Central
> Subject: Re: [Qt-interest] best way set a background photo for a QGraphicsView?
>
> I'd probably just use a QGraphicsPixmapItem use centerOn(pixItem), and make the drawing elemets a child of this, so they express themselves in relative coordinates tot he  background image. This will make it easy if you have to flatten it. Make sure though, that you don't clip children to parent, which I think is not a problem by default.This should also make zooming trivial as well, as scaling the parent will scale the children
>
>
>
>
>
> ----- Original Message ----
> From: nobodyhere<pem.accounts.spam at gmail.com>
> To: qt-interest<qt-interest at trolltech.com>
> Sent: Tue, April 13, 2010 11:48:23 PM
> Subject: [Qt-interest] best way set a background photo for a QGraphicsView?
>
> My app will open a screen shot (photo / png etc) and allow the user to draw objects on it (such as rectangles, polygons, text objects), and resize / move / delete / copy-paste these objects.  The background image (screen shot / photo) will always be the same (but you can zoom in etc).  I should use QGraphicsView for this, with a background image?
>
> What is the correct / optimized way to set a background photo for QGraphicsView?
>
> thank you for any leads
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list