1 / 10

Toolkits

Toolkits. Il existe 4 principales boites à outils (toolkits) graphiques : Xt / Motif Gtk Windows Qt. Seul certaines fonctionnent sur toutes les plates-formes : Unix (Linux) Mac Windows. Qt. Qt est une bibliothèque contenant : Fonctions d’interfaces graphique

sierra-king
Download Presentation

Toolkits

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Toolkits • Il existe 4 principales boites à outils (toolkits) graphiques : • Xt / Motif • Gtk • Windows • Qt • Seul certaines fonctionnent sur toutes les plates-formes : • Unix (Linux) • Mac • Windows

  2. Qt • Qt est une bibliothèque contenant : • Fonctions d’interfaces graphique • Composants d’accès aux données • Connexions réseaux • Gestions de processus • Développée en C++ par la société Trolltech (www.trolltech.com) • Sous licence GPL pour les projets « libres » • Disponible pour Windows, Unix et Mac OS

  3. Couches logicielles

  4. Signals et slots (1) • Mécanisme de communications entre les composants de Qt

  5. Signals et slots (2) • Exemple concret (DrawQt) Clic sur le bouton “ellipse” Lors du clic sur le bouton : Envoie du signal clic par le bouton Ce signal est connecté à la méthode “ClicEllipse” Execution de la méthode “ClicEllipse”

  6. Signals et slots (3) Définir un signal / slot • class myClass : public Qobject { • Q_OBJECT • … • signals: • void event (); • … • public slots: • void action (); • … • }; Fichier.h • … • emit(evenementSurvenu()); • … • connect(myClass,SIGNAL(event(),myClass,SLOT(action()); Fichier.cxx

  7. moc moc_maclasse.cpp gcc maclasse.obj Signals et slots (4) • Mécanisme interne : maclasse.h maclasse.cpp

  8. GUI (Graphic User Interface) 2 méthodes de définir une GUI en Qt • A la main (long, mais efficace et instructif) • A l’aide du Designer : uic Sauvegarde monfichier.ui monfichier.h Description interface

  9. Exemple simple #include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton hello("Hello world!"); hello.resize(100, 30); hello.show(); return app.exec(); } Headers de Qt Création de l’application Création d’un bouton Redimentionnement Affichage du bouton Lancement de l’application et attente de fin

More Related