« Programmation Qt/Un premier programme » : différence entre les versions
Contenu supprimé Contenu ajouté
Création : == Un premier programmme == <small>En construction</small> Voici un programme très simple qui permettera l'affichage d'une fenêtre (plus précisément la fenêtre principale). |
Aucun résumé des modifications |
||
Ligne 1 : | Ligne 1 : | ||
{{Programmation Qt}} |
|||
== Un premier programmme == |
== Un premier programmme == |
||
<small>En construction</small> |
<small>En construction</small> |
||
Voici un programme très simple qui permettera l'affichage d'une fenêtre (plus précisément la fenêtre principale). |
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 <code>main.cpp</code> |
|||
#include <QApplication> |
|||
#include <mainwindow.h> |
|||
int main ( int argc, char *argv[] ) |
|||
{ |
|||
QApplication app; |
|||
MainWindow mainWin; |
|||
mainWin.show(); |
|||
return app.exec(); |
|||
} |
|||
Le fichier <code>mainwindow.h</code> |
|||
#ifndef MAINWINDOW_H |
|||
#define MAINWINDOW_H |
|||
#include <QMainWindow> |
|||
class MainWindow : public QMainWindow |
|||
{ |
|||
Q_OBJECT |
|||
public: |
|||
MainWindow(); |
|||
}; |
|||
#endif |
Version du 7 mars 2007 à 11:29
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