Results 1 to 4 of 4

Thread: Can't access Baseclass

  1. #1
    Join Date
    Jan 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Can't access Baseclass

    Hey there,

    I have a MainWindow and a Dialog Class. Both inherit from the Qt Classes and from the Ui::Classes.
    I can't access a Dialogs' LineEdit from a Method of the MainWindow. Why is that? Its public inherited ?!

    The Error:
    /home/kingfinn/Updat0r/updat0r/ui_sitedialog.h:38: error: ‘QLineEdit* Ui_SiteDialog::nameLineEdit’ is inaccessible

    Cheers,

    kf

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Can't access Baseclass

    1. Get a book on C++ and object oriented programming, preferably about Qt.
    2. Read it
    3. Then look into one of these techniques to get data from different objects:
    3.1. Signals and slots
    3.2. Pass your mainwindow object to your dialog object

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can't access Baseclass

    It's also bad practice to refer to a component of one form from the context of another. Keep them self contained. If you need a dialog to update one of its controls, send it a signal it can process.

  4. #4
    Join Date
    Jan 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't access Baseclass

    Quote Originally Posted by tbscope View Post
    1. Get a book on C++ and object oriented programming, preferably about Qt.
    2. Read it
    3. Then look into one of these techniques to get data from different objects:
    3.1. Signals and slots
    3.2. Pass your mainwindow object to your dialog object
    Already done :P
    I'm sorry I was pretty tired yesterday. Thank you

    Okay, I'll do it as said now, but I still don't understand why I can't access the members of the Baseclass.
    Last edited by kingfinn; 25th May 2010 at 08:53.

Similar Threads

  1. web access
    By ashwinibm in forum Newbie
    Replies: 1
    Last Post: 15th January 2010, 10:27
  2. How To Access To Child's Of A Tab
    By hotjava in forum Qt Programming
    Replies: 1
    Last Post: 14th December 2008, 13:21
  3. access to ftp server
    By peace_comp in forum Qt Programming
    Replies: 3
    Last Post: 31st May 2008, 16:34
  4. Access widgets
    By Gayathri in forum Newbie
    Replies: 2
    Last Post: 17th November 2006, 14:37
  5. Database access from Qt
    By nimmyj in forum General Discussion
    Replies: 1
    Last Post: 16th November 2006, 14:11

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.