nileshsince1980
18th November 2009, 06:23
Hello All,
I have created application on Windows/Linux using QT 4.5.1 (Open Source). I have used QGraphicsView/Scene architecture to display Graphics items (rectangles etc).
I have implemented zoom selection functionaliy. i.e. on Mouse selection, the zoom in the selected area using QGraphicsView::fitInView() function.
My code works fine on Linux but on Windows XP it hangs/slows down after 2 consecutive zoom in operations.
Please tell me what could be the cause ?? Or any clue.
Following is the functions from my code,
void MyGraphicsView:: PaintEvent(QPaintEvent * event)
{
QPaintEvent *newEvent = new QPaintEvent(event->region().boundingRect());
QGraphicsView:: PaintEvent(event);
delete newEvent;
}
void MyGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{
QPainterPath path = scene()->selectionArea();
scene()->clearSelection();
fitInView(path.boundingRect(), Qt::KeepAspectRatio);
QGraphicsView::mouseReleaseEvent(event);
}
Some observations :
1. I have notices that same code works fine on Windows for QT 4.3.1 but not with QT
4.5.1. I have also checked the updations/changes of in 4.5.1 version but not able to
find much info. But in 4.5.0, QGraphicsView::fitInView() function has been improved for
very small viewport. (see the link http://qt.nokia.com/developer/changes/changes-4.5.0
2. I have obersred after some debugging that QGraphicsView:: PaintEvent(event) function is taking too much time to paint the view after 2/3 consecutive zoom-in operations.
Can anybody tell me why QGraphicsView:: PaintEvent(event) function is taking too much time.
Thanks in advance.
Nilesh
I have created application on Windows/Linux using QT 4.5.1 (Open Source). I have used QGraphicsView/Scene architecture to display Graphics items (rectangles etc).
I have implemented zoom selection functionaliy. i.e. on Mouse selection, the zoom in the selected area using QGraphicsView::fitInView() function.
My code works fine on Linux but on Windows XP it hangs/slows down after 2 consecutive zoom in operations.
Please tell me what could be the cause ?? Or any clue.
Following is the functions from my code,
void MyGraphicsView:: PaintEvent(QPaintEvent * event)
{
QPaintEvent *newEvent = new QPaintEvent(event->region().boundingRect());
QGraphicsView:: PaintEvent(event);
delete newEvent;
}
void MyGraphicsView::mouseReleaseEvent(QMouseEvent *event)
{
QPainterPath path = scene()->selectionArea();
scene()->clearSelection();
fitInView(path.boundingRect(), Qt::KeepAspectRatio);
QGraphicsView::mouseReleaseEvent(event);
}
Some observations :
1. I have notices that same code works fine on Windows for QT 4.3.1 but not with QT
4.5.1. I have also checked the updations/changes of in 4.5.1 version but not able to
find much info. But in 4.5.0, QGraphicsView::fitInView() function has been improved for
very small viewport. (see the link http://qt.nokia.com/developer/changes/changes-4.5.0
2. I have obersred after some debugging that QGraphicsView:: PaintEvent(event) function is taking too much time to paint the view after 2/3 consecutive zoom-in operations.
Can anybody tell me why QGraphicsView:: PaintEvent(event) function is taking too much time.
Thanks in advance.
Nilesh