You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, August 24th 2007, 9:03pm

[SOLVED] QGraphicsView::translate() does not work

Hello,
i already did some search on google and here, but didn't found anything.
I cannot get QGraphicsView::translate() to work. Even the example "portedcanvas" is not able to translate the view to the left, right or something else. Do I have the wrong understanding of the method? I tried the example on win-qt4.2.3, win-qt4.3.1 and linux-qt.4.3.1. The two former ones even in debug mode. But the translate() has no effect on the view. But I expected it to move in some direction (at least in the example).

Regards,
Martin

This post has been edited 1 times, last edit by "mc_zitrone" (Aug 25th 2007, 12:30am)


maverick_pol

Intermediate

  • "maverick_pol" is male

Posts: 364

Location: Lublin, Poland

Occupation: Student/C++ Developer

  • Send private message

2

Saturday, August 25th 2007, 12:21am

RE: QGraphicsView::translate() does not work

Hi,

Could you give me an example of function arguments' values?
Thanks.

Maverick

3

Saturday, August 25th 2007, 12:29am

RE: QGraphicsView::translate() does not work

Hi, thanks for your answer. With some more hours of work, I did solve it on my own. For some reason, I had to do view->setSceneRect(big numbers) to make the translation work. I called translate() with mousemove delta values calculated in a subclass of QGraphicsView. However, with setSceneRect() my view->scale in a wheelevent of a parent widget didn't work any more. Some tears later I figured out, that if I call scale() from within my SubQGraphicsView (which makes more sense anyway), for some reason it works... :)
I think, I also had to remove the transformAnchor in the view.

However, thanks, and i'll try to mark this thread as solved.
Regards,
Martin