Results 1 to 6 of 6

Thread: QWizard not showing

  1. #1
    Join Date
    Aug 2007
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QWizard not showing

    Hi all.

    I am having trouble getting my QWizard to work.

    I have the following QAction:

    Qt Code:
    1. newAction = new QAction(QIcon(":/images/png/16x16/note_add.png"), tr("&New"), this);
    2. newAction->setShortcut(QKeySequence::New);
    3. newAction->setStatusTip(tr("Create new profile"));
    4. connect(newAction, SIGNAL(triggered()), this, SLOT(newSlot()));
    To copy to clipboard, switch view to plain text mode 

    and the newSlot, slot:

    Qt Code:
    1. void MainWindow::newSlot()
    2. {
    3. NewWizard wizard;
    4. wizard.show();
    5.  
    6. }
    To copy to clipboard, switch view to plain text mode 

    And my NewWizard class:

    Qt Code:
    1. NewWizard::NewWizard(QWidget *parent) : QWizard(parent)
    2. {
    3. addPage(new IntroPage);
    4. addPage(new InformationPage);
    5.  
    6. setPixmap(QWizard::BannerPixmap, QPixmap(":/images/png/tux.png"));
    7. setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/png/tux.png"));
    8.  
    9. setWindowTitle(tr("New profile"));
    10. }
    11.  
    12. IntroPage::IntroPage(QWidget *parent) : QWizardPage(parent)
    13. {
    14. setTitle(tr("Introduction"));
    15. setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/png/tux.png"));
    16.  
    17. QLabel *label = new QLabel(tr("bla bla bla bla bla bla bla"));
    18. label->setWordWrap(true);
    19.  
    20. QVBoxLayout *layout = new QVBoxLayout;
    21. layout->addWidget(label);
    22.  
    23. setLayout(layout);
    24. }
    25.  
    26. InformationPage::InformationPage(QWidget *parent) : QWizardPage(parent)
    27. {
    28. setTitle(tr("Information"));
    29.  
    30. QLabel *label = new QLabel(tr("bla bla bla bla bla bla bla"));
    31. label->setWordWrap(true);
    32.  
    33. QVBoxLayout *layout = new QVBoxLayout;
    34. layout->addWidget(label);
    35.  
    36. setLayout(layout);
    37. }
    To copy to clipboard, switch view to plain text mode 

    But when I go to the menu and choose the new action, the wizard is not displayed. What am I doing wrong?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWizard not showing

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2007
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QWizard not showing

    Thanks alot

  4. #4
    Join Date
    May 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: QWizard not showing

    I'm having the same problem. But the link in the previous answer seems to be broken....
    Is it possible to launch a QWizard from a QMainWindow ?

  5. #5
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWizard not showing

    Either call wizard.exec(); or instantiate NewWizard:

    NewWizard *wizard = new NewWizard;
    wizard->show();

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QWizard not showing

    http://www.qtcentre.org/faq.php?faq=...reated_widgets
    Learn a bit about the scope of objects in C++ and it will probably become clearer.

    Is it possible to launch a QWizard from a QMainWindow ?
    Yes.
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

Similar Threads

  1. QWizard signal problem
    By oguzy in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2008, 10:43
  2. QWizard, QComboBox and registerField() issue
    By RThaden in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 12:18
  3. Create QWizard UI
    By jd in forum Qt Tools
    Replies: 1
    Last Post: 17th March 2008, 12:36
  4. about qt/embedded widgets showing in ARM platform
    By xianshuiren in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 3rd December 2007, 05:48

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.