Python PyQt5.QtGui 模块,QGuiApplication() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用PyQt5.QtGui.QGuiApplication()

项目:sarasvati    作者:advaita-krishna-das    | 项目源码 | 文件源码
def run(self):
        self.__app = QGuiApplication(sys.argv)
        engine = QQmlApplicationEngine()
        engine.rootContext().setContextProperty("plex", self.__plex)
        engine.rootContext().setContextProperty("processor", self.__processor)
        engine.rootContext().setContextProperty("brain", self.__brain)

        engine.load("plugins/app/gui/ui/views/App.qml")  # todo
        engine.quit.connect(self.__app.quit)

        self.__api.events.message.subscribe(self.__on_message)
        self.__init_panel(engine)
        self.__create_root_thought()

        sys.exit(self.__app.exec_())
项目:QTodoTxt2    作者:QTodoTxt    | 项目源码 | 文件源码
def run():
    # First set some application settings for QSettings
    QtCore.QCoreApplication.setOrganizationName("QTodoTxt")
    QtCore.QCoreApplication.setApplicationName("QTodoTxt2")
    # Now set up our application and start
    app = QtWidgets.QApplication(sys.argv)
    # it is said, that this is lighter:
    # (without qwidgets, as we probably don't need them anymore, when transition to qml is done)
    # app = QtGui.QGuiApplication(sys.argv)

    name = QtCore.QLocale.system().name()
    translator = QtCore.QTranslator()
    if translator.load(str(name) + ".qm", "..//i18n"):
        app.installTranslator(translator)

    args = _parseArgs()

    setupSingleton(args)

    _setupLogging(args.loglevel)

    engine = QQmlApplicationEngine(parent=app)
    controller = MainController(args)
    engine.rootContext().setContextProperty("mainController", controller)
    path = os.path.join(os.path.dirname(__file__), 'qml')
    engine.addImportPath(path)
    mainqml = os.path.join(path, 'QTodoTxt.qml')
    engine.load(mainqml)

    setupAnotherInstanceEvent(controller)

    controller.start()
    app.setWindowIcon(QtGui.QIcon(":/qtodotxt"))
    app.exec_()
    sys.exit()