Advertisement
Guest User

Michael S.

a guest
Dec 6th, 2010
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <QtCore/QObject>
  2. #include <QtGui/QApplication>
  3. #include <QtGui/QFileDialog>
  4. #include <QtDeclarative/QDeclarativeView>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     QApplication a(argc, argv);
  9.  
  10.     QFont appFont("Bitstream Vera Serif");
  11.     a.setFont(appFont);
  12.  
  13.     QString qmlFile;
  14.     if(argc < 2) {
  15.         qmlFile = QFileDialog::getOpenFileName(0,"Select QML-File","/home","QML Files (*.qml)");
  16.         if(qmlFile.isNull()) {
  17.             return 1;
  18.         }
  19.     }
  20.     else {
  21.         qmlFile = argv[1];
  22.     }
  23.  
  24.     QDeclarativeView *view = new QDeclarativeView();
  25.     view->resize(480,272);
  26.     qDebug("Loading file %s",qPrintable(qmlFile));
  27.     view->setSource(QUrl::fromLocalFile(qmlFile));
  28.  
  29. #ifdef Q_WS_QWS
  30.     view->showFullScreen();
  31.     a.setOverrideCursor(Qt::BlankCursor);
  32. #else
  33.     view->show();
  34. #endif
  35.  
  36.     return a.exec();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement