PDA

View Full Version : What does it mean?



anafor2004
17th January 2008, 15:37
When we define a class in a header file, i write down this code "" Ui::Dialog ui; ""
what does it mean?
If we have Two form first one is MainWindow the second one is Dialog window, these forms all classes contains these code why?



class MainWindow : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:

int i;
QTranslator translator;
//Dialog::Dialog *a=new Dialog();
MainWindow(QWidget *parent = 0);
~MainWindow();


private:
Ui::MainWindow ui;


void languageChange(int);

protected:
void changeEvent(QEvent* event);
void keyPressEvent(QKeyEvent *e);
public slots:
void english();
void turkce();
void deutsch();
void reset();
void sayfa();


};

class Dialog : public QDialog , public Ui::Dialog
{
Q_OBJECT
public:
Dialog(QWidget *parent = 0);

private:
Ui::Dialog ui;

public slots:
void gizle();
};


thanks

high_flyer
17th January 2008, 16:31
When we define a class in a header file, i write down this code "" Ui:ialog ui; ""
what does it mean?
It means the same as

int var;
But in this case the type of the variable 'ui' is of type 'MainWindow' which is under the scope or namespace 'Ui'.

In this case, these are variables generated automatically by the uic (the ui compiler) out of the form you destined with designer (and saved as a *.ui file).


f we have Two form first one is MainWindow the second one is Dialog window, these forms all classes contains these code why?
Here (http://doc.trolltech.com/4.3/designer-using-a-component.html) is why.

anafor2004
18th January 2008, 07:10
Thanks for your reply.

jpn
18th January 2008, 08:15
You're mixing Single Inheritance and Multiple Inheritance approaches. Highly recommended reading: Qt Designer Manual- Using a Component in Your Application (http://doc.trolltech.com/latest/designer-using-a-component.html).