Results 1 to 20 of 29

Thread: How to transfer data entered in a QWizard to other classes?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: How to transfer data entered in a QWizard to other classes?

    Quote Originally Posted by BillGates View Post
    Thanks so much for the code snippet, I didnt find this anywhere, in no example! Perhaps they considered normal people would know this..(qobject_cast). I had no clue that that must be done :< Thank you
    It's there in many places, I assure you.

    About ::next(), I understand you are saying to Not reimplement ::next, but reimplement ::nextId() instead. I want to do some stuff when the user clicks "next" so ::next() seems more intuitive..
    No, in that case you need to reimplement QWizardPage::initializePage() on the next page you want to show.



    PS: apparently if I do in myWizard constructor :
    setButton(QWizard::NextButton, mybuton);
    connect ( mybuton, SIGNAL(clicked()), this, SLOT(my_slot()));

    my_slot() is executed AFTER the next Page's initializePage() ?!?! (is this logical?)
    Yes, it's logical.


    Read this article, it might help you understand how wizards work:
    http://doc.trolltech.com/qq/qq22-qwizard.html
    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.


  2. #2
    Join Date
    Feb 2010
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2

    Default Re: How to transfer data entered in a QWizard to other classes?

    ok, i dont know if this is normal or not.... but apparently after casting i cannot access data members of wiz-> or even methods of wiz that themselves access members of the wizard object. I get a SIGSEGV upon running the program... (tried with static_cast too, although i have the q_object macro)

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

    Default Re: How to transfer data entered in a QWizard to other classes?

    Check if wizard() doesn't return 0 or that qobject_cast doesn't return 0.
    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.


  4. #4
    Join Date
    Feb 2010
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2

    Default Re: How to transfer data entered in a QWizard to other classes?

    Qt Code:
    1. in myPage1 constructor:
    2.  
    3. qDebug()<< this->wizard() ; // outputs QObject(0x0)
    4.  
    5. myWizard *wiz = qobject_cast<myWizard*>( wizard() ); //also tried myWizard *wiz = qobject_cast<myWizard*>((myWizard*) wizard() );
    6.  
    7. if(wiz) { wiz->my_slot("testing") ; //does not get executed }
    To copy to clipboard, switch view to plain text mode 


    i set the Page in the myWizard constructor using : addPage( new myPage1( ) );

    What am i screwing up?

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

    Default Re: How to transfer data entered in a QWizard to other classes?

    Before you add the page to the wizard (which happens after the page constructor is executed) the page doesn't belong to the wizard so wizard() returns 0.
    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.


  6. The following user says thank you to wysota for this useful post:

    BillGates (7th May 2010)

  7. #6
    Join Date
    Feb 2010
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    2

    Default Re: How to transfer data entered in a QWizard to other classes?

    I am so ashamed of myself. I am a complete idiot. I will give up programming and go be a janitor... Qt is great though....

Similar Threads

  1. Default Item View classes and returning data from model
    By xerionn in forum Qt Programming
    Replies: 8
    Last Post: 23rd April 2009, 19:50
  2. Item View classes and returning data !
    By xerionn in forum Newbie
    Replies: 3
    Last Post: 16th January 2009, 08:52
  3. Qcj Data classes initial release
    By croftj in forum Qt-based Software
    Replies: 0
    Last Post: 1st May 2007, 02:51
  4. Replies: 1
    Last Post: 9th March 2007, 21:07
  5. Record update windowd entered data saving
    By MarkoSan in forum Qt Programming
    Replies: 56
    Last Post: 18th January 2006, 18:50

Tags for this Thread

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.