Results 1 to 6 of 6

Thread: ui not declared in scope

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: ui not declared in scope

    Form1::Form1():QMainWindow(NULL,0)

    It should be like this.....
    ui(new Ui::QtMySql)

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: ui not declared in scope

    @Gokulnathvc: the only problem with the line you pointed to is that is doesn't take a parent and pass is to the QMainWindow constructor:
    Qt Code:
    1. Form1::Form1(QWidget* parent = 0) : QMainWindow(parent, 0)
    To copy to clipboard, switch view to plain text mode 

    @Steve: the main problem is that he forgot to integrate the generated code, he only included the header ui_form.h:
    Qt Code:
    1. #include "ui_form.h"
    2.  
    3. class Form1:public QMainWindow
    4. {
    5. Q_OBJECT
    6. public:
    7. Form1();
    8. ~Form1();
    9.  
    10. protected slots:
    11. void function1();
    12. //this needs to be added:
    13. private:
    14. Ui_Form ui; //object or pointer whatever you prefer
    15. // or you can use the class from Ui nanespace:
    16. // Ui::Form ui;
    17. // read the documentation page linked in my previous post
    18. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. GetFileSizeEx was not declared in this scope
    By Threepwood in forum Qt Programming
    Replies: 2
    Last Post: 8th February 2011, 12:03
  2. `lineEdit' was not declared in this scope?
    By i4ba1 in forum Qt Programming
    Replies: 2
    Last Post: 18th November 2009, 14:36
  3. QDomDocument was not declared in this scope
    By grantbj74 in forum Newbie
    Replies: 5
    Last Post: 25th August 2009, 09:43
  4. glutSolidSphere was not declared in this scope error
    By nuts_fever_007 in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2009, 04:56
  5. Replies: 2
    Last Post: 28th December 2007, 18:30

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.