PDA

View Full Version : Can't access Baseclass



kingfinn
25th May 2010, 02:15
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

tbscope
25th May 2010, 07:18
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

squidge
25th May 2010, 08:55
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.

kingfinn
25th May 2010, 09:30
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.