Results 1 to 2 of 2

Thread: Problem getting some Windows and Dialogs to show.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Qt products
    Qt4

    Default Problem getting some Windows and Dialogs to show.

    Specifically I have a simply application window that I created using QtDesigner, which worked fine on 4.5.1 but now behaves strangely on 4.7.1: I have to create and then show it twice, it will only show the second time it is created:
    Qt Code:
    1. QApplication a(argc, argv);
    2.  
    3. {
    4. WindowGUIClass w;
    5.  
    6. w.show();
    7. w.setFocus(); // <-- this one never appears (even without the enclosing scope causing it to get destroyed)
    8. }
    9.  
    10. WindowGUIClass w2;
    11.  
    12. w2.show(); // <-- now it will actually appear
    13. w2.setFocus();
    14.  
    15. return a.exec();
    To copy to clipboard, switch view to plain text mode 

    So I hacked my way around that problem after spending a couple of hours trying to work out what the problem is (comparing project settings to a newly created Qt app project, removing ALL extraneous code from the initialization, making it identical to the default generated Qt app).
    The only slightly non-standard thing that is in effect when running this program is that it is being spawned by another process rather than started by the user.
    Now I have run into another problem: QMessageBox will not display when I use the following code:

    Qt Code:
    1. inline void show_error(const char* err, const char* title = "Error!")
    2. {
    3. QMessageBox::critical(NULL, title, err); // <-- nothing appears...
    4. }
    To copy to clipboard, switch view to plain text mode 

    I am using Windows XP 32bit and Qt 4.7.1. My projects were created in 4.5.1, using Visual Studio 2005, and the Qt VS plugin. I am now using VS2008 with the Qt VS plugin.

    So, I ask, what is the problem here? Are there any commonly known problems with getting windows to show? I have tried stepping though the code that is supposed to show the window, but to no avail...

    /edit So I managed to fix the QMessageBox not displaying by giving a parent QWidget rather than NULL. I also noticed that when the parent IS NULL, the setVisible(true) call buried in the critical() function generates a Windows error sound... Qt bug?!
    Last edited by billw; 19th November 2010 at 16:24.

Similar Threads

  1. Replies: 0
    Last Post: 23rd April 2010, 17:25
  2. Replies: 1
    Last Post: 16th November 2009, 07:10
  3. QWT doesnt show any windows
    By Cal in forum Qwt
    Replies: 5
    Last Post: 30th June 2009, 17:05
  4. How to show two main windows?
    By Althor in forum Newbie
    Replies: 4
    Last Post: 13th October 2008, 08:30
  5. Setting default icon for all windows / dialogs
    By steg90 in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2007, 10:04

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.