当前位置: 首页>>代码示例>>Python>>正文


Python QQmlApplicationEngine.addImageProvider方法代码示例

本文整理汇总了Python中PyQt5.QtQml.QQmlApplicationEngine.addImageProvider方法的典型用法代码示例。如果您正苦于以下问题:Python QQmlApplicationEngine.addImageProvider方法的具体用法?Python QQmlApplicationEngine.addImageProvider怎么用?Python QQmlApplicationEngine.addImageProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtQml.QQmlApplicationEngine的用法示例。


在下文中一共展示了QQmlApplicationEngine.addImageProvider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: QApplication

# 需要导入模块: from PyQt5.QtQml import QQmlApplicationEngine [as 别名]
# 或者: from PyQt5.QtQml.QQmlApplicationEngine import addImageProvider [as 别名]
        The text gets printed in the corresponding qml component
        
        :param string text: The text to append at the end of the current qml component text
        """
        if text:
            previousText = self.log.property('text')
            outputText = '{}\n>>>{}'.format(previousText, text)
            self.log.setProperty('text', outputText)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    
    appEngine = QQmlApplicationEngine()
    
    context = appEngine.rootContext()
    appEngine.addImageProvider('viewerprovider', CvImageProvider()) # Hack to make qml believe provider is valid before its creation
    appEngine.addImageProvider('trackerprovider', CvImageProvider()) # Hack to make qml believe provider is valid before its creation
    appEngine.addImageProvider('recorderprovider', CvImageProvider()) # Hack to make qml believe provider is valid before its creation
    appEngine.addImageProvider('calibrationprovider', CvImageProvider()) # Hack to make qml believe provider is valid before its creation
    
    analysisImageProvider = PyplotImageProvider(fig=None)
    appEngine.addImageProvider("analysisprovider", analysisImageProvider)
    analysisImageProvider2 = PyplotImageProvider(fig=None)
    appEngine.addImageProvider("analysisprovider2", analysisImageProvider2)
    appEngine.load(QUrl('./qml/MouseTracker.qml'))
    
    win = appEngine.rootObjects()[0]
    
    if not DEBUG:
        logger = Logger(context, win, "log")
        sys.stdout = logger
开发者ID:SainsburyWellcomeCentre,项目名称:Pyper,代码行数:33,代码来源:tracking_gui.py


注:本文中的PyQt5.QtQml.QQmlApplicationEngine.addImageProvider方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。