Results 1 to 11 of 11

Thread: Window not responding

  1. #1
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Window not responding

    I have a app that starts a window (QMainWindow). Pressing a button creates a new window(QMainWindow). The first window cannot be changed, or closed, etc., the second window does fine. When I close the second window, the focus returns to the first window, but it still doesn't respond to anything.

    Without posting any code, is there something obvious I can look for, or is there a better way?

    The main goal is to have a initial window, that can spawn one of three different windows. In turn each of these windows will spawn one or more windows for data display.

    I am pretty new at gui programming, so thanks for any help...

    -mark

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Window not responding

    How do you display the second window? do you use show()?

  3. #3
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window not responding

    Quote Originally Posted by marcel View Post
    How do you display the second window? do you use show()?
    Yes.

    in the .h file
    Qt Code:
    1. private:
    2. ObjectName * newWindow;
    To copy to clipboard, switch view to plain text mode 

    in the .cpp
    Qt Code:
    1. newWindow = new ObjectName(this);
    2. newWindow->show();
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Window not responding

    Do you intercept any kind of events for the first window?
    What do you do in the first place to make the first window not respond, while the second is visible?

  5. #5
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window not responding

    Quote Originally Posted by marcel View Post
    Do you intercept any kind of events for the first window?
    What do you do in the first place to make the first window not respond, while the second is visible?
    No first window is just a main screen to start one of 3 modes.

    I made the second window (window modal).

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Window not responding

    Qt::WindowModal
    The window is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.
    After you close this modal window( I assume you actually hide it ), do you also delete it? This would solve your problem.
    If you can't delete it and you just hide it, at least change it's modality to non modal, to stop blocking its parent.

  7. #7
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window not responding

    So, when I close it using the close() function or the x icon on the title bar, it is just hiding it, not deleting it?

    Edit: I guess reading the API would help. Does the x icon issue a close()?
    Last edited by markcole; 18th April 2007 at 21:56.

  8. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Window not responding

    No, I just assumed that when you close it you hide it for later use...
    In this case...No idea at all why you get this problem...

    Do you have to set it WindowModal?

  9. The following user says thank you to marcel for this useful post:

    markcole (18th April 2007)

  10. #9
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window not responding

    Quote Originally Posted by marcel View Post
    No, I just assumed that when you close it you hide it for later use...
    In this case...No idea at all why you get this problem...

    Do you have to set it WindowModal?
    Well, I set it to windowModal in designer. I don't change it in the code I write.

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

    Default Re: Window not responding

    Maybe setting attribute Qt::WA_DeleteOnClose would help.
    J-P Nurmi

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

    markcole (19th April 2007)

  13. #11
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Window not responding

    Thanks....I will give it a try.

Similar Threads

  1. Fixing default Window position with move.
    By VireX in forum Qt Programming
    Replies: 4
    Last Post: 3rd April 2007, 22:13
  2. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 12:07
  3. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 09:41
  4. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 11:21

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.