コード例 #1
0
ファイル: main.cpp プロジェクト: ittennull/Learn
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);

	QDir::setCurrent(QCoreApplication::applicationDirPath());

	App application;

	qmlRegisterType<App>("App", 1, 0, "App");
	qmlRegisterType<CollectionModel>("CollectionModel", 1, 0, "CollectionModel");
    qmlRegisterType<QStringListModel>("QStringListModel", 1, 0, "QStringListModel");

	QtQuick2ApplicationViewer viewer;
	viewer.rootContext()->setContextProperty("app", &application);
	viewer.rootContext()->setContextProperty("checkModeCpp", &application.getCheckMode());
	viewer.rootContext()->setContextProperty("dictionaryModeCpp", &application.getDictionaryMode());
	viewer.rootContext()->setContextProperty("rememberModeCpp", &application.getRememberMode());
	viewer.setMainQmlFile(QStringLiteral("qml/Learn/main.qml"));
	viewer.showExpanded();

	viewer.setIcon(QIcon(":/new/g/dictionary-icon.png"));
    viewer.setTitle("Learn");

    application.setWindow(&viewer);

    return app.exec();
}
コード例 #2
0
ファイル: main.cpp プロジェクト: fer-d/qml-fingerprint
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile(QString("qml/main.qml"));
    viewer.setIcon(QIcon("qrc:/res/logo.png"));
    viewer.setMinimumHeight(255);
    viewer.setMaximumHeight(255);
    viewer.setMinimumWidth(660);
    viewer.setMaximumWidth(660);
    viewer.showExpanded();

    return app.exec();
}