本文整理汇总了Python中PySide.QtDeclarative.QDeclarativeView.setViewport方法的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView.setViewport方法的具体用法?Python QDeclarativeView.setViewport怎么用?Python QDeclarativeView.setViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtDeclarative.QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView.setViewport方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QmlGui
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setViewport [as 别名]
class QmlGui(Gui):
USES = ['geonames', 'qmllocationprovider']
def __init__(self, core, dataroot, parent=None):
self.app = QApplication(sys.argv)
self.core = core
self.view = QDeclarativeView()
self.view.statusChanged.connect(self._status_changed)
glw = QGLWidget()
self.view.setViewport(glw)
self.controller = Controller(self.view, self.core)
self.settings = SettingsWrapper(self.core)
rc = self.view.rootContext()
rc.setContextProperty('controller', self.controller)
rc.setContextProperty('settings', self.settings)
rc.setContextProperty('gps', GPSDataWrapper(self.core))
self.view.setSource(os.path.join('qml','main.qml'))
def get_gps(self, callback):
self.controller.callback_gps = callback
def show(self):
self.view.showFullScreen()
self.app.exec_()
self.core.on_destroy()
def _status_changed(self, error):
logger.error(self.view.errors())
示例2: DiffView
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setViewport [as 别名]
class DiffView(QObject):
def __init__(self, app, difftext, leftfile, rightfile):
QObject.__init__(self)
self.app = app
self.difftext = difftext
self.window = QMainWindow()
self.window.setWindowTitle("Log Diffs")
self.leftfile = leftfile
self.rightfile = rightfile
self.view = QDeclarativeView()
self.glw = QtOpenGL.QGLWidget()
self.view.setViewport(self.glw)
self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
self.window.setCentralWidget(self.view)
self.rc = self.view.rootContext()
self.rc.setContextProperty('controller', self)
self.rc.setContextProperty('difftext', self.difftext)
self.view.setSource('diffview.qml')
self.window.show()
@Slot()
def diff_viewer(self):
p = subprocess.Popen("gvim -d {0} {1}".format(self.leftfile, self.rightfile), shell=True)
sts = os.waitpid(p.pid, 0)[1]
def checked(self):
for build in self.build_list.checked():
yield build
示例3: LogView
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setViewport [as 别名]
class LogView(QObject):
def __init__(self, app, logpath, id, sdk_model, row_number):
QObject.__init__(self)
self.app = app
self.logpath = logpath
self.window = QMainWindow()
self.window.setWindowTitle("Raptor build viewer")
self.build_list = BuildListModel(self.logpath)
self.controller = BuildController(app, self.build_list, id, sdk_model, row_number)
self.view = QDeclarativeView()
self.glw = QtOpenGL.QGLWidget()
self.view.setViewport(self.glw)
self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
self.window.setCentralWidget(self.view)
self.rc = self.view.rootContext()
self.rc.setContextProperty('controller', self.controller)
self.rc.setContextProperty('pyBuildListModel', self.build_list)
self.rc.setContextProperty('logpath', self.logpath)
self.rc.setContextProperty('info', sdk_model.sdk_info(id))
self.rc.setContextProperty('window', self.window)
self.rc.setContextProperty('row', row_number)
self.view.setSource('logchooser.qml')
self.window.show()
def checked(self):
for build in self.build_list.checked():
yield build
示例4: main
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setViewport [as 别名]
def main(argv):
app = QApplication(argv)
display_widget = QDeclarativeView()
display_widget.setViewport(QGLWidget())
display_widget.setResizeMode(QDeclarativeView.SizeRootObjectToView)
display_widget.setSource(QUrl('drawer_demo.qml'))
display_widget.show()
display_widget.resize(640,480)
sys.exit(app.exec_())
示例5: SDKView
# 需要导入模块: from PySide.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PySide.QtDeclarative.QDeclarativeView import setViewport [as 别名]
class SDKView(QObject):
def __init__(self, app, window, logpath=None):
QObject.__init__(self)
self.app = app
self.sdk_list_model = SDKListModel()
self.controller = SDKController(app, self.sdk_list_model)
self.view = QDeclarativeView()
self.glw = QtOpenGL.QGLWidget()
self.view.setViewport(self.glw)
self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
window.setCentralWidget(self.view)
self.rc = self.view.rootContext()
self.rc.setContextProperty('sdk_controller', self.controller)
self.rc.setContextProperty('pySDKListModel', self.sdk_list_model)
self.view.setSource('sdkchooser.qml')
@Slot()
def quit(self):
self.controller.quit()