home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_qt3.idb / usr / freeware / Qt / examples / canvas / main.cpp.z / main.cpp
Encoding:
C/C++ Source or Header  |  2002-04-08  |  1.2 KB  |  62 lines

  1. #include <qstatusbar.h>
  2. #include <qmessagebox.h>
  3. #include <qmenubar.h>
  4. #include <qapplication.h>
  5. #include <qimage.h>
  6.  
  7. #include "canvas.h"
  8.  
  9. #include <stdlib.h>
  10.  
  11. extern QString butterfly_fn;
  12. extern QString logo_fn;
  13.  
  14. int main(int argc, char** argv)
  15. {
  16.     QApplication app(argc,argv);
  17.  
  18.     /*
  19.     qDebug("sizeof(QCanvasPolygonalItem)=%d",sizeof(QCanvasPolygonalItem));
  20.     qDebug("sizeof(QCanvasText)=%d",sizeof(QCanvasText));
  21.     qDebug("sizeof(QWidget)=%d",sizeof(QWidget));
  22.     qDebug("sizeof(QLabel)=%d",sizeof(QLabel));
  23.     */
  24.  
  25.  
  26.  
  27.     if ( argc > 1 )
  28.     butterfly_fn = argv[1];
  29.     else
  30.     butterfly_fn = "butterfly.png";
  31.  
  32.  
  33.     if ( argc > 2 )
  34.     logo_fn = argv[2];
  35.     else
  36.     logo_fn = "qtlogo.png";
  37.  
  38.  
  39.     QCanvas canvas(800,600);
  40.     canvas.setAdvancePeriod(30);
  41.     Main m(canvas);
  42.     m.resize(m.sizeHint());
  43.  
  44.     qApp->setMainWidget(&m);
  45.  
  46.     m.setCaption("Qt Example - Canvas");
  47.     if ( QApplication::desktop()->width() > m.width() + 10
  48.      && QApplication::desktop()->height() > m.height() +30 )
  49.     m.show();
  50.     else
  51.     m.showMaximized();
  52.  
  53.     m.show();
  54.     //    m.help();
  55.     qApp->setMainWidget(0);
  56.  
  57.     QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) );
  58.  
  59.     return app.exec();
  60. }
  61.  
  62.