Matthias Kleine wrote:
> Hi there,
> 
> I'm currently working on an application which makes use of QtJambi and I
> experience major performance problems. The situation is the following:
> I've got a QGraphicsView which is used to display a street map and cars
> moving on it. Streets and cars both are custom graphics items. The
> graphics view displays only a small fraction of the map. Every 50ms the
> position of all cars is updated.
> 
> QtJambi takes too much time redrawing the graphics view. Profiling the
> C++ Qt libraries, I found out that in my case more than 40% of the time 
> is spent in QGraphicsScene::items(const QPolygonF &polygon, ...) (called 
> by QGraphicsView::paintEvent to determine the visible items) which makes 
> use of several methods  which in turn call QGraphicsItem::boundingRect.
> As the graphics items are custom graphics items implemented in Java, a 
> call to boundingRect (C++ -> Java) is very expensive.

Compared to calling it in C++, it is rather costly, yes...

> First of all I'm wondering whether this is a known problem (with a known 
> solution)?

Many moving items in a scene is a common degenerate usecase for the 
default configuration of QGraphicsView. You can change the viewport 
update mode to do a full viewport update, in which case less time is 
spent in figuring out collisions etc...

http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QGraphicsView.ViewportUpdateMode.html#FullViewportUpdate
http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QGraphicsView.html#setViewportUpdateMode(com.trolltech.qt.gui.QGraphicsView.ViewportUpdateMode)

best regards,
Gunnar
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to