예제 #1
0
def main():
    import sys

    QGuiApplication.setApplicationName("Gallery")
    QGuiApplication.setOrganizationName("QtProject")
    QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling)

    app = QGuiApplication(sys.argv)

    QIcon.setThemeName("gallery")

    settings = QSettings()

    style = QQuickStyle.name()
    if style:
        settings.setValue("style", style)
    else:
        QQuickStyle.setStyle(settings.value("style"))

    engine = QQmlApplicationEngine()
    engine.rootContext().setContextProperty("availableStyles",
                                            QQuickStyle.availableStyles())
    engine.load(QUrl("qrc:/gallery.qml"))
    if not engine.rootObjects():
        sys.exit(-1)

    sys.exit(app.exec_())
예제 #2
0
def main():
    import sys

    QGuiApplication.setApplicationName("Automotive")
    QGuiApplication.setOrganizationName("QtProject")
    QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    QGuiApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)

    app = QGuiApplication(sys.argv)

    QIcon.setThemeName("automotive")

    engine = QQmlApplicationEngine()
    engine.load(QUrl("qrc:/qml/automotive.qml"))
    if not engine.rootObjects():
        sys.exit(-1)

    sys.exit(app.exec_())