Qt inheritance problem

Hello, I'm a beginer of Qt/GUI program.
I want to ask a question about "inheritance" accessability in C++.
I want to know why the function "GoToCellDialog::on_lineEdit_textChanged()"
can access the member of Ui::GoToCellDialog's public member,
though it inherited in a "private inheritance".

The program works fine,
and i saw this source in the book "C++ GUI Programming with Qt 4" which translated in Japanese.
But my friend says in the original edition, it says "public inheritance".

//source is
class Ui::GoToCellDialog
{
public:
QLabel *lable;
QLineEdit *lineEdit;
QPushButton *okButton;
...
};

class GoToCellDialog : public QDialog, private Ui::GoToCellDialog
{
Q_OBJECT//Qt macro

private slots:
void on_lineEdit_textChanged();
};

void GoToCellDialog::on_lineEdit_textChanged()
{
okButton->setEnable( lineEdit->hasAcceptableInput() );
}
Last edited on
Thanks a lot.
I already have a good solution of it^^

When the class GoToCellDialog inherit Ui::GoToCellDialog in "private",
then class GoToCellDialog will have "private" members which are ( public or protected)Ui::GoToCellDialog members.
So, it occurs no problem on function on_lineEdit_textChanged(),
for *okButton can count as a private member of GoToCellDialog class,
and also on_lineEdit_textChanged() function is one of private slots(member function).
Topic archived. No new replies allowed.