Results 1 to 8 of 8

Thread: using *.ui file with QWizard

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: using *.ui file with QWizard

    @anda_skoa

    I have tried your recommendation, yet there is error:

    .../widget.cpp:9: error: no matching function for call to 'Ui::Widget::setupUi(Widget* const)'
    ui->setupUi(this);
    ^

    I have done just that: create new Widget project and add and change the *.ui file with QWizard
    I am sorry, I have no idea what I am missing,
    Can you please give me some hint? Thanks

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: using *.ui file with QWizard

    This is from memory so forgive me if it is not perfect

    Pro file
    Qt Code:
    1. ...
    2. HEADERS += wizard.h
    3. SOURCES += wizard.cpp
    4. FORMS += wizard.ui
    5. ...
    To copy to clipboard, switch view to plain text mode 
    Wizard.h
    Qt Code:
    1. ...
    2. namespace Ui {
    3. class Wizard;
    4. };
    5.  
    6. class Wizard: public QWizard
    7. {
    8. Q_OBJECT
    9. public:
    10. Wizard(QWidget *p = 0);
    11. ~Wizard();
    12. ...
    13. private:
    14. Ui::Wizard *ui;
    15. }
    To copy to clipboard, switch view to plain text mode 
    Wizard.cpp
    Qt Code:
    1. #include "wizard.cpp"
    2. #include "ui_wizard.h"
    3.  
    4. Wizard(QWidget *p):
    5. QWizard(p),
    6. ui(new Ui::Wizard)
    7. {
    8. ui->setupUi(this);
    9. }
    10.  
    11. ~Wizard()
    12. {
    13. delete ui;
    14. }
    To copy to clipboard, switch view to plain text mode 
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  3. #3
    Join Date
    Jan 2016
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: using *.ui file with QWizard

    Thank you very much @ChrisW67 !!!

    Just to save some little debugging to the future,
    here is tested code fore someone else just to copy & paste.

    wizadr.h
    Qt Code:
    1. #include <QWizard>
    2.  
    3. namespace Ui {
    4. class Widget;
    5. }
    6.  
    7. class Wizard : public QWizard
    8. {
    9. Q_OBJECT
    10.  
    11. public:
    12. explicit Wizard(QWidget *parent = 0);
    13. ~Wizard();
    14.  
    15. private:
    16. Ui::Widget *ui;
    17. };
    To copy to clipboard, switch view to plain text mode 

    wizard.cpp
    Qt Code:
    1. #include "wizard.h"
    2. #include "ui_wizard.h"
    3.  
    4. Wizard::Wizard(QWidget *parent) :
    5. QWizard(parent),
    6. ui(new Ui::Widget)
    7. {
    8. ui->setupUi(this);
    9. }
    10.  
    11. Wizard::~Wizard()
    12. {
    13. delete ui;
    14. }
    To copy to clipboard, switch view to plain text mode 

    Thanks again everyone for help.

Similar Threads

  1. QWizard fit
    By baray98 in forum Qt Programming
    Replies: 7
    Last Post: 14th November 2010, 17:27
  2. QWizard
    By rmagro in forum Qt Programming
    Replies: 1
    Last Post: 20th October 2009, 17:12
  3. Help with QWizard
    By afflictedd2 in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2009, 22:23
  4. QWizard
    By rmagro in forum Qt Programming
    Replies: 8
    Last Post: 26th September 2008, 21:41
  5. QWizard
    By steg90 in forum Qt Programming
    Replies: 6
    Last Post: 14th December 2007, 10:37

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.