Hi ,
Anybody know what is the current frame rate of QGraphicsView? And is it possible to adjust manually?
Thanks for any advise.
Hi ,
Anybody know what is the current frame rate of QGraphicsView? And is it possible to adjust manually?
Thanks for any advise.
QGraphicsView does not have a frame rate.
Are you talking about animations? In that case, it depends on how you're doing the animation and you need to provide more details.
yes , I mean animation.
I am trying to make an animation that move a list of pixmap from left to right. I didn't use State machine. I just make a list of QPropertyAnimation and set the start and end value.
However, the animation is a little bit choppy when it is run in full screen mode. Seem that it is out-sync-ed with screen refresh rate. Therefore I would like to adjust the frame rate / animation update rate.
If it's choppy then it means GraphicsView can't deal with that much information to process. You need to optimize some things by different ways described all over this forum (and not only here).
Thanks. But I find that even I move a single rectangle on QGraphicsView, it is slightly choppy... Anyway , I will check the old post first.
If I understand correctly (correct me if I am wrong) , in order to assign a specific update rate to view , it should :
1) Set QGraphicsView update module to NoViewportUpdate
2) Connect a timer's timeout signal to QGraphicsScene::update() slot
However, I have a question about the above behaviour. I think QGraphicsScene::update() would update every items on scene , no matter the region/rect is changed or not. Am I correct? Is it possible to update only the changed region/rect like what BoundingRectViewportUpdate mode do?
It shouldn't normally be choppy. However, many things can affect painting speed. If you're on linux you might want to enable the raster or opengl paint systems for more speed. If this is on windows you are almost certainly doing something wrong, since it should be plenty fast enough. Post more code for more help.
Thanks.
hmm... I think I should call it flickering instead of choppy. I made a very simple program with only a big red rectangle moving around the screen. With the options of -graphicssystem raster / opengl. It will look better. But still have a slightly fickering or tearing depend on system.
Linux:
- raster : flickering
- opengl: segfault (seem to be driver issue. )
Mac:
- raster : flickering
- opengl : tearing
The code
Qt Code:
#include <QtGui> Q_OBJECT public: } }; int main(int argc , char **argv){ QGraphicsView view; QGraphicsScene scene; view.setScene(&scene); scene.setSceneRect(0,0,1280,1024); Rect* rect = new Rect(); rect->setRect(0,0,500,500); scene.addItem(rect); rect->setBrush(brush); QPropertyAnimation anim(rect,"pos"); int duration = 5000; anim.setDuration(duration); anim.setLoopCount(-1); anim.start(); view.show(); return app.exec(); } #include "main.moc"To copy to clipboard, switch view to plain text mode
Last edited by benlau; 7th April 2010 at 12:09. Reason: added attachment
Hi benlau,
I have the same problem, my code is very similar and same render hints,
have you resolved? how?
thank you
Hi themk,
I still can't find a prefect solution , the only way I could try is to avoid a big rectangle moving in a constant speed.
p.s I have patched Qt and allow it to set animation fps by environment variable.
Bookmarks