Results 1 to 5 of 5

Thread: Overriding methods for QWizardPage(s) created in Qt Designer and accessing widgets.

  1. #1
    Join Date
    Oct 2012
    Location
    The land of pain (NY)
    Posts
    99
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Default 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:

    Qt Code:
    1. #include <QWizard>
    2. #include <QtCore>
    3. #include "Interface.h"
    4.  
    5. namespace Ui
    6. {
    7. class FlashWizard;
    8. class IntroPage;
    9. }
    10.  
    11. class FlashWizard : public QWizard
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. explicit FlashWizard(QWidget *parent = 0);
    17. virtual ~FlashWizard();
    18.  
    19. private:
    20. Ui::FlashWizard* ui;
    21. QString SupportFile;
    22. QString iniFile;
    23. QSettings* settings;
    24. ushort Language_Id;
    25. bool convertedOK;
    26.  
    27.  
    28. };
    29.  
    30. class IntroPage : public QWizardPage
    31. {
    32. Q_OBJECT
    33.  
    34. public:
    35.  
    36. IntroPage(QWidget *parent = 0);
    37.  
    38. void initializePage();
    39. int nextId() const;
    40.  
    41.  
    42. };
    43.  
    44. #endif // FLASHWIZARD_H
    To copy to clipboard, switch view to plain text mode 

    I try and implement the method initializePage() as:

    Qt Code:
    1. void IntroPage::initializePage()
    2. {
    3. setSubTitle(tr("Blah-Bah"));
    4. }
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Overriding methods for QWizardPage(s) created in Qt Designer and accessing widge

    In Qt Designer promote one QWizardPage to IntroPage

  3. #3
    Join Date
    Oct 2012
    Location
    The land of pain (NY)
    Posts
    99
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Default 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 View Post
    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'
    Last edited by astodolski; 24th October 2012 at 20:50.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  5. #5
    Join Date
    Oct 2012
    Location
    The land of pain (NY)
    Posts
    99
    Thanks
    7
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Default 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.

Similar Threads

  1. Replies: 9
    Last Post: 5th July 2012, 23:48
  2. Replies: 6
    Last Post: 20th June 2012, 14:21
  3. Dynamic plugin: accessing parent's methods
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 4th January 2011, 10:16
  4. Replies: 1
    Last Post: 15th September 2010, 23:26
  5. Accessing QMainWindow methods
    By vieraci in forum Qt Programming
    Replies: 2
    Last Post: 21st April 2009, 09:38

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.