Overriding methods for QWizardPage(s) created in Qt Designer and accessing widgets.
Hello,
I have not seen any examples that illustrate use of custom classes to override methods in QWizardPage class. All wizard examples I've seen are written outside of the designer. For instance, in Qt Creator I create a Wizard with two pages. All the widgets are contained in the ui file and I need access to each of the page's widgets as well as the methods i.e. initializePage(), nextId() etc. in both pages. The new project creation wizard creates an application with one class and the ui file. How do I override the two mentioned methods? In the header file created by the project wizard in Qt Creator, I have the following default header file:
Code:
#include <QWizard>
#include <QtCore>
#include "Interface.h"
namespace Ui
{
class FlashWizard;
class IntroPage;
}
class FlashWizard : public QWizard
{
Q_OBJECT
public:
explicit FlashWizard
(QWidget *parent
= 0);
virtual ~FlashWizard();
private:
Ui::FlashWizard* ui;
ushort Language_Id;
bool convertedOK;
};
class IntroPage : public QWizardPage
{
Q_OBJECT
public:
void initializePage();
int nextId() const;
};
#endif // FLASHWIZARD_H
I try and implement the method initializePage() as:
Code:
void IntroPage::initializePage()
{
setSubTitle(tr("Blah-Bah"));
}
That code is never executed. I can only access widgets from the main class - FlashWizard and get/set properties from the ui object, created in the main class. I am required to create UI objects in the designer and access them in code as per projects requirements. I am stuck as how to do that.
I hope that is clear, Thanks in advance
Re: Overriding methods for QWizardPage(s) created in Qt Designer and accessing widge
In Qt Designer promote one QWizardPage to IntroPage
Re: Overriding methods for QWizardPage(s) created in Qt Designer and accessing widge
That sounds like you're suggesting adding a page and promoting it to IntroPage? Is that correct?
Dzięki
Added after 5 minutes:
Quote:
Originally Posted by
Lesiok
In Qt Designer promote one QWizardPage to IntroPage
I get errors:
d:\flashwizard\ui_flashwizard.h:38: error: C2327: 'Ui_FlashWizard::IntroPage' : is not a type name, static, or enumerator
d:\flashwizard\ui_flashwizard.h:82: error: C2061: syntax error : identifier 'IntroPage'
Re: Overriding methods for QWizardPage(s) created in Qt Designer and accessing widge
Yes, we use this method on a daily basis. Errors can result from improperly specified header file with the definition of the class IntroPage.
Re: Overriding methods for QWizardPage(s) created in Qt Designer and accessing widge
Please explain in a little more detail. There are no real methods detailing promoting a QWizardPage to an existing class.