Biff (UNIX only)Biff is a simple graphical program to indicate whether there is new mail; it looks exactly like xbiff but is much shorter. Header file: /**************************************************************************** ** $Id: //depot/qt/main/examples/biff/biff.h#2 $ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #ifndef BIFF_H #define BIFF_H #include <qwidget.h> #include <qdatetime.h> #include <qpixmap.h> class Biff : public QWidget { Q_OBJECT public: Biff( QWidget *parent=0, const char *name=0 ); protected: void timerEvent( QTimerEvent * ); void paintEvent( QPaintEvent * ); void mousePressEvent( QMouseEvent * ); private: QDateTime lastModified; QPixmap hasNewMail; QPixmap noNewMail; QString mailbox; bool gotMail; }; #endif // BIFF_H biff.cpp implements this custom widget. Note in particular how two images (hasmail_bmp_data and nomail_bmp_data, both from bmp.cpp) are included into the executable. /**************************************************************************** ** $Id: //depot/qt/main/examples/biff/biff.cpp#2 $ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include "biff.h" #include <qstring.h> #include <qfileinfo.h> #include <qpainter.h> #include <unistd.h> #include <stdlib.h> #include "bmp.cpp" Biff::Biff( QWidget *parent, const char *name ) : QWidget( parent, name, WType_Modal ) { QFileInfo fi = QString(getenv( "MAIL" )); if ( !fi.exists() ) { QString s( "/var/spool/mail/" ); s += getlogin(); fi.setFile( s ); } if ( fi.exists() ) { mailbox = fi.absFilePath(); startTimer( 1000 ); } setMinimumSize( 48, 48 ); setMaximumSize( 48, 48 ); resize( 48, 48 ); hasNewMail.loadFromData( hasmail_bmp_data, hasmail_bmp_len ); noNewMail.loadFromData( nomail_bmp_data, nomail_bmp_len ); gotMail = FALSE; lastModified = fi.lastModified(); } void Main: /**************************************************************************** ** $Id: //depot/qt/main/examples/biff/main.cpp#2 $ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include < |
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
![]()
![]() Le Qt Developer Network au hasard![]() Introduction à Qt Quick pour les développeurs C++Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.
CommunautéRessources
Liens utilesContact
Qt dans le magazine |
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 2.3 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com