Results 1 to 11 of 11

Thread: Update to 4.4.2 - Now I Have A Transparent Dialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    35
    Thanked 1 Time in 1 Post

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Quote Originally Posted by jpn View Post
    You cannot block the event loop with a busy loop (in fact, in the minimal test case you don't run an event loop at all). The application has no chance to deliver paint events, thus nothing gets painted.
    In that case this example should perform the same using both versions of Qt, no?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Quote Originally Posted by mclark View Post
    In that case this example should perform the same using both versions of Qt, no?
    Perhaps 4.3.4 creates the native window handle upon show(), whereas 4.4.0 probably doesn't do it at that point yet. It doesn't mean that the minimal test app works with either version. You MUST let the application process its events in order to make the dialog responsive.
    Qt Code:
    1. for ( int i = 0; i < 0x7FFFFFFF; i++ ) // Simulate some work...
    2. app.processEvents();
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    mclark (6th October 2008)

  4. #3
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    35
    Thanked 1 Time in 1 Post

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Quote Originally Posted by jpn View Post
    You MUST let the application process its events in order to make the dialog responsive.
    Ahhhh.... Now I see what you mean about the minimal test app.

    So, what would you recommend for a solution for the real app?

    I have a QDialog which needs to make a library call that may take 3-7 seconds (on average) to complete. I want to display something to let a user know that processing is happing (the app is NOT hung). I was using the GenericWaitDlg class described above.

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Quote Originally Posted by mclark View Post
    So, what would you recommend for a solution for the real app?

    I have a QDialog which needs to make a library call that may take 3-7 seconds (on average) to complete. I want to display something to let a user know that processing is happing (the app is NOT hung). I was using the GenericWaitDlg class described above.
    What kind of library call is that? Unless there is a way to split the task into smaller chunks, I'm afraid you have to process it in a worker thread and deliver results to the main GUI thread for example by using queued signals.
    J-P Nurmi

  6. #5
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    35
    Thanked 1 Time in 1 Post

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Quote Originally Posted by jpn View Post
    What kind of library call is that?
    The call is to a library I have no control over (not a Qt call). I was hoping there might be a solution other than using a worker thread.

    Does this sound reasonable:
    1. create my GenericWaitDlg
    2. create a worker thread
    3. connect a slot (closeGenericWaitDlg()) to the finished() signal of the thread
    4. in the run() method of the thread, make my library call
    5. when the library call is finished the thread should shutdown
    6. in the closeGenericWaitDlg() method call dlg.done(0) to close the wait dialog

  7. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Yes, sounds reasonable. Just remember not to touch GUI in the worker thread.
    J-P Nurmi

  8. The following user says thank you to jpn for this useful post:

    mclark (6th October 2008)

  9. #7
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    35
    Thanked 1 Time in 1 Post

    Default Re: Update to 4.4.2 - Now I Have A Transparent Dialog

    Thanks for your help, jpn. It is much appreciated!

Similar Threads

  1. Update to 4.4.2 generates new warnings
    By mclark in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2008, 19:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.