Results 1 to 7 of 7

Thread: QWizard

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QWizard

    Hi,

    I have some classes derived from QWidget. I want to display these one at a time, i.e.one screen, then the next screen, just like in a wizard.

    This is the code I have :

    Qt Code:
    1. QWizard wizard;
    2. wizard.addPage( new QWizardPage( new CanView( this ) ) );
    3. wizard.show();
    To copy to clipboard, switch view to plain text mode 

    The view gets displayed and then just exits? I normally show this view within a workspace as my app is mdi type.

    Any reason for this?

    Regards,
    Steve

  2. #2
    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: QWizard

    The wizard goes out of scope. Allocate it on the heap with 'new' or use blocking QDialog::exec() (QWizard is a QDialog).
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWizard

    Thanks

    The wizard is now displayed, but the view isn't? Just a form with Finsish and Cancel button?

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

    Default Re: QWizard

    its because you are creating an empty wizard page with CanView object as its parent.
    Make CanView a subclass of QWizardPage and ad *it* to the wizard.

    P.S
    I recommend you read some C++ basics
    ==========================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.

  5. #5
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWizard

    Thanks,

    Although I don't need to go and read some C++ basics thank you very much, just wasn't so sure about using QWizardPage...

  6. #6
    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: QWizard

    Quote Originally Posted by steg90 View Post
    just wasn't so sure about using QWizardPage...
    Neither was I since I never used it before. But the moment I opened QWizard docs and took a look at the detailed description, it was clear right away how to use it. You should do the same when using unfamiliar classes.
    J-P Nurmi

  7. #7
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWizard

    The views I was adding to the wizard I had already written a while back and they are all derived from QWidget which QWizardPage inherits so I just thought they would be ok without having to change their base class, ok, I should have thought more on this and obvioulsy the constructor for QWizardPage does more behind the scenes. Before the post back from High Flyer I had actually changed one of them to derive from QWizardPage, sorry to have not posted back to say I'd fixed it.

Similar Threads

  1. Qwizard crashed when created in a slot
    By joshlareau in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2008, 09:16
  2. Style Sheet on QWizard
    By desch in forum Qt Programming
    Replies: 2
    Last Post: 6th December 2007, 17:12
  3. Disabling Wizard Buttons in a QWizard
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 30th October 2007, 17:53
  4. QWizard not resizing properly for non-unicode
    By jgreetham in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2007, 10:42

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.