本文整理汇总了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