Example #1
0
File: main.cpp Project: khris/qv
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);

#ifdef Q_OS_SYMBIAN
    viewer.setMainQmlFile(QLatin1String("qrc:/qml/qvapp/qv.qml"));
    viewer.setSource(QUrl(QLatin1String("qrc:/qml/qvapp/qv.qml")));
#else
    viewer.setMainQmlFile(QLatin1String("qml/qvapp/qv.qml"));
#endif

#ifdef Q_OS_SYMBIAN
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.showFullScreen();
#elif defined(Q_WS_MAEMO_5)
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.showMaximized();
#elif defined(Q_OS_ANDROID)
    viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    viewer.showFullScreen();
#else
    Qt::WindowFlags flags = Qt::MSWindowsFixedSizeDialogHint
            | Qt::CustomizeWindowHint
            | Qt::WindowCloseButtonHint
            | Qt::WindowMinimizeButtonHint;
    viewer.setWindowFlags(flags);
    viewer.setResizeMode(QDeclarativeView::SizeViewToRootObject);
    viewer.show();
#endif

    return app.exec();
}
Example #2
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QmlApplicationViewer viewer;
    viewer.setMainQmlFile(QLatin1String("qml/gallery/main.qml"));
    viewer.show();

    return app.exec();
}
Example #3
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    bool use_qml;
#ifdef USE_QML
    use_qml = true;
#else 
    use_qml = false;
#endif

    QStringList options = app.arguments();
    if (options.contains("--use-qml"))
        use_qml = true;
    if (options.contains("--dont-use-qml"))
        use_qml = false;

    if (use_qml) {
        qRegisterMetaType<DNSSECTest>("DNSSECTest");
        qmlRegisterType<DNSSECTest, 1>("DNSSECTools", 1, 0, "DNSSECTest");
        qmlRegisterType<TestManager, 1>("DNSSECTools", 1, 0, "TestManager");

        QmlApplicationViewer viewer;
        QDeclarativeContext *context;
        viewer.addImportPath(":/qml");
        viewer.setWindowIcon(QIcon(":/images/dnssec-check-64x64.png"));
        viewer.setWindowTitle("DNSSEC-Check");

        TestManager manager;
        context = viewer.rootContext();
        context->setContextProperty("testManager", &manager);

        #ifdef IS_MEEGO
        viewer.setSource(QUrl("qrc:/qml/MeegoDnssecCheck.qml"));
        #else
        viewer.setSource(QUrl("qrc:/qml/DnssecCheck.qml"));
        #endif


        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
        #ifdef IS_MEEGO
        viewer.showFullScreen();
        #else
        viewer.show();
        #endif

        return app.exec();
    } else { // don't use QML
        MainWindow mainWindow;
        mainWindow.setOrientation(MainWindow::Auto);

        #ifdef Q_OS_SYMBIAN
        mainWindow.showFullScreen();
        #elif defined(Q_WS_MAEMO_5)
        mainWindow.showMaximized();
        #else
        mainWindow.show();
        #endif

        return app.exec();
    }
}