Results 1 to 3 of 3

Thread: QWizard hides my QMainwindow instance upon showing and closes my app upon finishing o

  1. #1
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QWizard hides my QMainwindow instance upon showing and closes my app upon finishing o

    I create a QWizard instance in a QMainwindow instance and show it with show(). When it is showed my mainwindow disappeares. When I finish or cancel the wizard, the application is closed. I have been searching and trying various things but still haven't got a clue. Can somebody help me out here, this makes no sense?

    The code looks like this:
    void MainWindow::startMyWizard()
    {
    pWizard_ = new CMyWizard( this );//CMyWizard directly derived from QWizard
    pWizard_->show();
    }

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

    Default Re: QWizard hides my QMainwindow instance upon showing and closes my app upon finishi

    This code doesn't do anything odd. Got a more elaborate example? Preferably a working one that we can compile and see what goes wrong.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWizard hides my QMainwindow instance upon showing and closes my app upon finishi

    I seem to have found a working solution. I connected the accepted() and rejected() signals of the wizard to the show() slot of the main window. Now the only remaining issue is that upon showing the wizard, the main window disappeares, until the wizard is closed or finished. Don't know yet how to solve that.

    The new code is:

    void MainWindow::startMyWizard()
    {
    pMyWizard_ = new QWizard( this );
    connect( pMyWizard_, SIGNAL( accepted() ), this, SLOT( show() ) );
    connect( pMyWizard_, SIGNAL( rejected() ), this, SLOT( show() ) );
    pMyWizard_->show();
    }

    Oh and b.t.w., I also had to call setQuitOnLastWindowClosed( false ) on the application(instance of QApplication in the main() function). If you want to have the whole code, let me know.

Similar Threads

  1. Qprocess and mpi not finishing
    By Spifffers in forum Qt Programming
    Replies: 10
    Last Post: 2nd April 2016, 18:40
  2. QWizard not showing
    By Ossi in forum Newbie
    Replies: 5
    Last Post: 11th May 2011, 05:25
  3. Finishing a thread in QThread
    By Tio in forum Newbie
    Replies: 9
    Last Post: 2nd June 2010, 17:38
  4. new dialog hides behind... help me please
    By cooper in forum Qt Programming
    Replies: 8
    Last Post: 14th June 2009, 21:55
  5. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 09:03

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.