[Interest] General QTimer question

Jason Kretzer Jason at gocodigo.com
Thu Dec 12 14:53:21 CET 2013

So, reuse the QWebViews instead of destroying and creating new ones.


- - - - - - - - - - - - - - - - - - - - - - -
Jason R. Kretzer

Application Developer
Google # 606-887-9011
Cell # 606-792-0079
Jason at gocodigo.com<mailto:Jason at gocodigo.com>

“quidquid latine dictum sit altum videtur”

[cid:image001.png at 01CECA4D.CA4030A0]

On Dec 12, 2013, at 8:44 AM, Harish Surana <surana4u at gmail.com<mailto:surana4u at gmail.com>> wrote:

I would say change your approach little bit:

1. Create only 3 instance of QWebView
2. Whenever QTimer shots change content of QWebView and show them.
3. After they are finished displaying content hide them.
4. repeat step 2 and 3

On Thu, Dec 12, 2013 at 1:57 PM, Jason Kretzer <Jason at gocodigo.com<mailto:Jason at gocodigo.com>> wrote:
Good Morning!

This is more a general question about the behavior of QTimer followed by a more specific instance of the question.

What can make a QTimer not timeout()?  In a general sense, what can make it miss its firing?

That was the general question.  My specific situation:

I display 3 QWebViews.  They are to be displayed on different parts of a screen for 20 seconds.  The 20 seconds is arbitrary, they could have different durations.  I have a QTimer that fires every second.  During any given second any of the three QWebViews can be triggered to start to display.  During each timeout of the QTimer, a slot is called which does the following
ALL content(html) that is supposed to start during this second are pulled from a QMultiMap.  There can be several – up to 3.
A for loop is used to iterate over them and show them as below.
They are loaded into a QWebView, geometry is set on the QWebView.
QWebView is shown
A SingleShot timer is set up to deleteLater the QWebView after the duration has expired.

In the case where durations for the content are all the same – lets say 20seconds – the QWebViews are basically synched up where they all start and stop on the same second.  Then the second right after they stop, they all three start up again.

Here is where the weirdness starts:  exactly every 1 minute, the QTimer which is supposed to fire every 1 second stops firing for 20-22seconds.  At the beginning of that time, the three QWebViews finish their previous time and leave as expected.  Then, nothing for 20-22 seconds.  The screen where they are supposed to be is blank.  I put qDebugs in the firing slot so I could see when it was being called but nothing.  I don’t see qDebug messages from anywhere else either during that time.  Like clockwork though, after the 20-22seconds of nothing, the QTimer starts firing again and repeats.

So, generally, what can keep a QTimer from firing like that?  I don’t have any processes that run every 1 minute like that.  Also, I am asking the QTimer to fire every 1 second – it is not like I am trying to get 10ms precision here.

If it makes any difference, this is a win7 pro OS.

Ideas?  I was intentionally a bit vague above as I am just asking for things to look for so that I can discover the answer on my own instead of just being given the answer.



- - - - - - - - - - - - - - - - - - - - - - -
Jason R. Kretzer

Application Developer
Google # 606-887-9011
Cell # 606-792-0079
Jason at gocodigo.com<mailto:Jason at gocodigo.com>

“quidquid latine dictum sit altum videtur”

Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131212/394b5db6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13452 bytes
Desc: image001.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131212/394b5db6/attachment.png>

More information about the Interest mailing list