QWizard, How pass information from QWizard to QWizardPage



  • Hi i am making a wizard to import text files,it is almost finished.
    I know how to register field and share between Pages
    void QWizardPage::registerField(etc..
    Also know how retrieve the value when the wizard finish

    void TextImportWizard::accept()
    {     qDebug() <<"ImportWizard::accept:";
          m_filename = field("reg_filename").toString();
        qDebug() <<"m_filename:"<< m_filename;
    }
    

    My problem is that registerField is memeber of QWizardPage,
    I need to register in the QWizard class
    Need to set the filename that will be open on the firts page.
    The QWizard class receive the filename,
    myWizard.setFilename(filename);
    Now i need to share the filename with the first QWizardPage.
    and the QWizard class dont have registerField method?
    So how can do?


  • Lifetime Qt Champion

    Hi,

    QWizard is a QWidget so you could register the wizard itself but if it's only to give an information to the first page why not just have a setFilename also on your first page ?



  • Thanks for the reply but
    I still do not understand
    registerField is a QWizardPage method, the Qwizard only can read field
    QVariant QWizard::field(const QString & name) const

    my chain action is:
    filename to=> QWizard then to=> QWizardPage

    You say to add a method setFilename to the QWizardPage
    If do that, now how get access to page method from the QWizard.
    also before the void QWizardPage::initializePage()

    Can you provide a code snip.
    Greetings


  • Lifetime Qt Champion

    If you add a property to your QWizard derived class, you can call registerField on it like you do for any widget inside your QWizardPage


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.