You are not logged in.

1

Monday, December 4th 2006, 4:33pm

Perceived flicker with marquee

Hello,

I'm trying to make a marquee but I can't get the perceived flicker away. I've checked and rechecked everything and the only reason I can find is that the drawPixmap is too slow from within Python. Yet that can't bee since it's the C function that is called.

The code is available here.

The paintEvent is as simple as:

def paintEvent(self, paintEvent):
painter = QtGui.QPainter(self)
painter.drawPixmap(0, 0, self.pixmap)


Why do I say 'perceived' is because the black line doesn't flicker, thus the buffering is working fine. I also thought it might be my LCD monitor but you still see flicker on the text on other monitors.

I've seen screen savers in Qt3 and even an example in Ruby and it looks like I'm doing everything right. But why o why do I still see flicker?

Junior

Professional

  • "Junior" is male

Posts: 1,613

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

2

Monday, December 4th 2006, 9:13pm

RE: Perceived flicker with marquee

Have you explored the QMovie class, not that this is an answer to your question, perusing it seemed similiar of what your doing.

3

Monday, December 4th 2006, 9:31pm

I have not tried the QMovie class so I will look into it.

But I did found a solution to my own problem. Apparently 25fps is not enough. If you decrease the timer value to 30 everything scrolls a lot smoother. I was surprised by this so I measured the actualy fps when it was set on 40 thinking that maybe some updates got missed but it actually got 25 fps.

The problem is that the app where I'm using this is doing so much more that it just can't sustain the 33.33fps setting. I always thought that 25fps was enough for smooth animation.

Junior

Professional

  • "Junior" is male

Posts: 1,613

Location: San Antonio, TX USA

Occupation: Senior Secure Systems Engineer

  • Send private message

4

Monday, December 4th 2006, 9:38pm

Hmmmm,

Then maybe an interjection from a static function from QCore Class... would be helpful? Not sure, but I'm glad you came to some success...

-- Extracted from:
http://doc.trolltech.com/4.2/qcoreapplic…l#processEvents

void QCoreApplication::processEvents ( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) [static]

Processes all pending events according to the specified flags until there are no more events to process.

You can call this function occasionally when your program is busy performing a long operation (e.g. copying a file).

See also exec(), QTimer, QEventLoop::processEvents(), flush(), and sendPostedEvents().

---------

Another what if, but sometimes it's good to rule out different ideas.

Junior

This post has been edited 1 times, last edit by "Junior" (Dec 4th 2006, 9:39pm)


5

Wednesday, December 13th 2006, 2:04pm

Java yields same result

I've reimplemented the scroller in java to see if the flicker was language specific but the result is identical.

Source available here.

The animation isn't smooth and you see some flicker even at 33fps. The only thing I can conclude is that the drawPixmap on the widget isn't fast enough.

Here: http://lists.trolltech.com/qt4-preview-f…9/msg00037.html is a discussion about KGoldrunner where someone tries to use QGV for his game. Ultimately he ends up using a lightweight Canvas for his project (http://kboard.sourceforge.net/wiki/index.php/Canvas) because QGV doesn't deliver.

When I look at the examples provided from Qt: Wiggly, Colliding Mice I must say that it also isn't 100% smooth. The Colliding Mice example in QtJambi even stalls en hiccups.

Is there something I am missing to make a simple scrolling banner? I would think that in this day and age this would work within a high level framework. No more assembler!