Results 1 to 3 of 3

Thread: Ui class errors

  1. #1
    Join Date
    Nov 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Ui class errors

    Hello everyone, I am trying to learn Qt4 in linux for a school project, unfortunately I don't have any help from teachers as all we have in school in VB so you guys are my only hope

    My problem is simple, I can't seem to be able to use the ui:: class at all. I am currently trying to write a simple program using the single inheritance approach as described here: http://doc.trolltech.com/4.3/designe...component.html
    But I have not been able to compile anything as I keep getting the following errors:
    Qt Code:
    1. learn.h:14: error: ‘Learn’ in namespace ‘Ui’ does not name a type
    2. learn.cpp:8: error: ‘ui’ was not declared in this scope
    3. learn.cpp:13: error: ‘ui’ was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

    here is the relevant code from learn.h:
    Qt Code:
    1. Ui::Learn ui;
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. ui.setupUi(this);
    2. ...
    3. ui.label->setText(ui.lineEdit->text());
    To copy to clipboard, switch view to plain text mode 

    I have followed the above links advice to the letter; I have included "ui_learn.h" in learn.h and have included learn.h in both learn.cpp and main.cpp.

    I have tried various examples from the Qt4 book from trolltech and the internet and these three errors are always present no matter what I write. I am really stumped. Do I need to wait for KDE4? I have Qt4 and Qt4-doc installed but am running KDE3. Any help or advice would be greatly appreciated.

    Thanks in advance,

    Calef13

    P.S: I am more than happy to post more code if anyone wants to see it.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Ui class errors

    Make sure that the objectName-property of the form is "Learn".
    J-P Nurmi

  3. #3
    Join Date
    Nov 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Ui class errors

    That fixed it, thank you so much. This has been bugging me for ages.

Similar Threads

  1. Creating object of other class in Run() method
    By santosh.kumar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 15:05
  2. Replies: 2
    Last Post: 16th March 2007, 09:04
  3. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04
  4. Replies: 2
    Last Post: 4th May 2006, 19:17
  5. How to propagate from one class to another
    By mahe2310 in forum Qt Programming
    Replies: 15
    Last Post: 20th March 2006, 01:27

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.