Results 1 to 6 of 6

Thread: Bug - Application Locks when user tries to move QDialog window

  1. #1
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Bug - Application Locks when user tries to move QDialog window

    I am using QT 4.7.0 on a Windows 7 32bit PC, developing in MS Visual Studio 2008.

    I have a QT application that opens a QDialog which operates as a video player. When playing the video (which uses a timer to update the QLabel displaying the current frame), if the user tries to move the window (by click and drag in the title bar), the whole application locks up. It unlocks when I press Ctrl-Alt-Delete to pull up the Windows Task Manager.

    Is this a known bug? Is there a fix for it? If not, is there a way I can disable the user's ability to move the dialog during playback?

    I appreciate any suggestions! Thanks!
    ~Susan

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Bug - Application Locks when user tries to move QDialog window

    Is this a known bug?
    Its probably a bug in your code, so I don't think its known.

    Can you show the code that manages the video and the slot that reacts to your timer for the frames?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    SKolaMunn (7th December 2010)

  4. #3
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Bug - Application Locks when user tries to move QDialog window

    I thought it was a QT bug because I saw a similar (but not exact) problem posted by someone else (http://bugreports.qt.nokia.com/brows...mment-tabpanel). Anyways, here's some code snippets:

    _pDisplayTimer = new QTimer(this);
    _pDisplayTimer->setInterval(_frameSpeedMilisec);
    connect(_pDisplayTimer, SIGNAL(timeout()), this, SLOT(displayNextFrame()));

    The displayNextFrame function grabs a new frame from the video, performs some computations (not on the image itself, on other data), and draws on the video frame, then sets the editted video frame to the label's pixmap. Should I have some sort of call that checks if other signals have been detected or something? I didn't think there was a bug in the code because everything else works during playback (checking/unchecking display options updates frame, etc) and you can set it to play at double speed and it still plays (so I didn't think it was an issue with the displayNextFrame function taking too much time). But, I can definitely believe the problem is in my code! Thanks for your help.

    UPDATE:

    I fixed the problem! I added QApplication:rocessEvents() at the end of my slot. Thanks so much for the help, you lead me to the solution.
    Last edited by SKolaMunn; 7th December 2010 at 17:09.

  5. #4
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Bug - Application Locks when user tries to move QDialog window

    You have be aware of the following: processEvents() starts a new event loop, which can lead to unpredictable behavior. Ideally, you wouldn't have to call processEvents. So now that you know that your calculations block the application too much, you might want to consider investigating QtConcurrent for future improvements.

  6. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Bug - Application Locks when user tries to move QDialog window

    You have be aware of the following: processEvents() starts a new event loop
    This is not true as far as I know, it only triggers event processing for the QApplication event loop.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #6
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Bug - Application Locks when user tries to move QDialog window

    True. The effect however is practically the same. Let's restate that as: processEvents() will re-enter the event loop, which may cause unpredictable behavior.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

Similar Threads

  1. Replies: 1
    Last Post: 18th August 2010, 13:39
  2. Disable Move option in window
    By BalaQT in forum Qt Programming
    Replies: 10
    Last Post: 27th December 2009, 06:37
  3. Move the window
    By santhoshv84 in forum Qt Programming
    Replies: 3
    Last Post: 16th September 2008, 09:54
  4. Move QT Window to different x display
    By jbpvr in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2007, 20:28
  5. Move window in Clone Mode
    By ultrabrite in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2006, 18:22

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.