[Qt-interest] Qt-Cocoa UI Elements not getting Events
Michael Jackson
mike.jackson at bluequartz.net
Tue Mar 23 16:16:20 CET 2010
On 3/23/10 10:51 AM, in article C7CE4D98.5651%mike.jackson at bluequartz.net,
"Michael Jackson" wrote:
> Qt 4.6.1 64/32 Bit Cocoa compiled on OS X 10.5.8 using GCC 4.2 (Apple
> supplied). I have a QMainWindow derived class with some buttons in it. One
> of the buttons is the typical "Play" button to start an animation. I use a
> QTime::singleShot() with some booleans that tell if the animation should
> continue or stop.
>
> <fake code>
> void MyMainWindow::UpdateAnimation()
> If ( Animate == true )
> {
> loadAndDisplayData();
> QTime::singleShot(33, this, UpdateAnimation();
> }
>
> This works great on Windows, OS X Carbon and Linux (X11). When I try this in
> Qt_Cocoa the Play button does not respond to the user clicking on the button
> once the animation begins, or it does if the user clicks and holds on the
> button until the button appears to change to the depressed state, then stays
> that way for a long time until finally sending its signal. I have tried this
> a few different ways including creating a separate thread to run the QTimers
> then using a signal to call back to the MainWindow::UpdateAnimation() method
> to do the updates. Same issue exists.
>
> Has anyone seen anything like this? Is this a bug perhaps? Am I somehow
> flooding the Event Queue so the GUI becomes unresponsive?
>
> It "feels" like I am somehow not really relinquishing control to the event
> loop even though it is my understanding by using a QTime::SingleShot() that
> is what should happen.
>
> Any insight or ideas are much appreciated.
>
> Mike Jackson
> Principal Software Engineer
> BlueQuartz Software (www.bluequartz.net)
>
Just to reply to my own thread. Turns out there must be some nuance
difference between how Carbon and Cocoa load images as I took out the
section that did the actual reading and loading of the image data from disk
and the responsiveness of the application is back where it should be.
I guess I should look at loading the image in yet a different thread and
then only push the image to the QWidget when the loading is complete?
Mike Jackson
More information about the Qt-interest-old
mailing list