« Programmation Qt/Un premier programme » : différence entre les versions

Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
Aucun résumé des modifications
ajout analyse
Ligne 45 : Ligne 45 :
{
{
}
}

== Analyse ==

Version du 9 mars 2007 à 12:14

Un premier programmme

En construction

Voici un programme très simple qui permettera l'affichage d'une fenêtre (plus précisément la fenêtre principale).

Voici le fichier main.cpp :

 #include <QApplication>
 #include "mainwindow.h"
 
 int main ( int argc, char *argv[] )
 {
      QApplication app;
      MainWindow mainWin;
      mainWin.show();
      return app.exec();
 }

Le fichier mainwindow.h :

 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
 #include <QMainWindow>
 
 class MainWindow : public QMainWindow
 {
      Q_OBJECT
 
 public:
      MainWindow();
 
 };
 
 #endif

Enfin voici le fichier mainwindow.cpp :

 #include <QtGui>
 #include "mainwindow.h"
 
 MainWindow::MainWindow()
 {
 }

Analyse