Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, April 2007
Re: Problems with translating QGraphicsView


Message 1 in thread

On Saturday 31 March 2007 21:54, Markus wrote:
> I am having problems using translate(dx, dy) on a QGraphicsView. While
> scale and rotate work fine, translate seems not to work.

Just to clarify, this is _not_ an April Fools' joke.

-- 
 [ signature omitted ] 

Message 2 in thread

On Saturday 31 March 2007 21:54, Markus wrote:
> I am having problems using translate(dx, dy) on a QGraphicsView. While
> scale and rotate work fine, translate seems not to work.

Maybe a simple test application helps illustrate the problem:

--main.cpp--
#include <QtGui>
#include "GView.h"

int main(int argc, char **argv)
{
	QApplication app(argc, argv);

	QGraphicsScene scene;
	scene.setSceneRect(-500, -500, 1000, 1000);

	QGraphicsRectItem *rect = new QGraphicsRectItem;
	rect->setRect(0, 0, 100, 100);
	scene.addItem(rect);

	GView view;
	view.setScene(&scene);
	view.resize(400, 300);
	view.show();

	return app.exec();
}
----

--gview.h--
class GView : public QGraphicsView
{
public:
	GView(QWidget *parent = 0) {}
	virtual ~GView() {}
	
	void mouseReleaseEvent(QMouseEvent *event) { translate(100, 0); }
};
----

When clicking into the window of the above application, there is no visible 
reaction.
This really looks like a bug to me. Is anyone from Trolltech reading this 
list?

-- 
 [ signature omitted ]