Results 1 to 4 of 4

Thread: What does it mean?

  1. #1
    Join Date
    Jan 2008
    Posts
    91
    Thanks
    8

    Default What does it mean?

    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?

    Qt Code:
    1. class MainWindow : public QMainWindow, public Ui::MainWindow
    2. {
    3. Q_OBJECT
    4. public:
    5.  
    6. int i;
    7. QTranslator translator;
    8. //Dialog::Dialog *a=new Dialog();
    9. MainWindow(QWidget *parent = 0);
    10. ~MainWindow();
    11.  
    12.  
    13. private:
    14. Ui::MainWindow ui;
    15.  
    16.  
    17. void languageChange(int);
    18.  
    19. protected:
    20. void changeEvent(QEvent* event);
    21. void keyPressEvent(QKeyEvent *e);
    22. public slots:
    23. void english();
    24. void turkce();
    25. void deutsch();
    26. void reset();
    27. void sayfa();
    28.  
    29.  
    30. };
    31.  
    32. class Dialog : public QDialog , public Ui::Dialog
    33. {
    34. Q_OBJECT
    35. public:
    36. Dialog(QWidget *parent = 0);
    37.  
    38. private:
    39. Ui::Dialog ui;
    40.  
    41. public slots:
    42. void gizle();
    43. };
    To copy to clipboard, switch view to plain text mode 

    thanks
    Last edited by jpn; 18th January 2008 at 08:13. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: What does it mean?

    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
    Qt Code:
    1. int var;
    To copy to clipboard, switch view to plain text mode 
    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 is why.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    anafor2004 (18th January 2008)

  4. #3
    Join Date
    Jan 2008
    Posts
    91
    Thanks
    8

    Default Re: What does it mean?

    Thanks for your reply.

  5. #4
    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: What does it mean?

    You're mixing Single Inheritance and Multiple Inheritance approaches. Highly recommended reading: Qt Designer Manual- Using a Component in Your Application.
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    anafor2004 (18th January 2008)

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.