February 4, 2012

Power_user_EX Power_user_EX
Lab Rat
2 posts

Need help… confused a bit with Qt Creator

 

Hi all .. I m new to Qt 4.7 programming using Qt Creator .. Have some questions :

1) Whats the basic difference between Qt Quick Application / UI and Qt Widget based app (Qt Gui application) in terms of programming style and convensions ? The main difference I see it Quick App uses QML for GUI design while Qt Widget based app uses UI forms to design GUI using Drag and drop .. after this is a bit confusing for me.

2) Can some 1 explain me this code :

  1. class MainWindow : public QMainWindow
  2. {
  3.     Q_OBJECT
  4.  
  5. public:
  6.     explicit MainWindow(QWidget *parent = 0);
  7.     ~MainWindow();
  8.  
  9. private:
  10.     Ui::MainWindow *ui;
  11. };

especially Q_OBJECT and

  1. explicit MainWindow (QWidget *parent = 0);

3) And this code :

  1. MainWindow::MainWindow(QWidget *parent) :
  2.     QMainWindow(parent),
  3.     ui(new Ui::MainWindow)
  4. {
  5.     ui->setupUi(this);
  6. }
  7.  
  8. MainWindow::~MainWindow()
  9. {
  10.     delete ui;
  11. }

4) If I want to program the same using Qt Quick what will the difference in code style ?

-Regards ,
Umang G (Power_user_EX)

 Signature 

Website @ http://www.ocfreaks.com

1 reply

February 4, 2012

koahnig koahnig
Mad Scientist
2099 posts

Qt creator is an IDE (Integrated Development Environment) which helps you developing your applications.

The sections, you are showing, are C++ source code presumably generated by the Qt creator based it templates.

Q_OBJECT is required for the Meta Object Compiler [developer.qt.nokia.com]

The explicit statement is explained here [glenmccl.com] for example.

All see there is basic C++ code. It is recommended to have sufficient knowledge of C++ for using it with Qt. You might want to look for a C++ tutorial first, if you are lacking this knowledge. One option for a tutorial. [cplusplus.com] Please consult google search for others.

 
  ‹‹ Labs for QT in Education      find QScrollArea viewport location relative to embedded widget ››

You must log in to post a reply. Not a member yet? Register here!