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


Python QQuickView.setGeometry方法代码示例

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


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

示例1: main

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import setGeometry [as 别名]
def main():
    app = QGuiApplication(sys.argv)
    app.setApplicationName('InfiniteCopy')

    openDataBase()

    view = QQuickView()

    clipboardItemModel = ClipboardItemModel()
    clipboardItemModel.create()

    filterProxyModel = QSortFilterProxyModel()
    filterProxyModel.setSourceModel(clipboardItemModel)

    clipboard = Clipboard()
    clipboard.setFormats([
        mimeText,
        mimeHtml,
        mimePng,
        mimeSvg
        ])
    clipboard.changed.connect(clipboardItemModel.addItem)

    engine = view.engine()

    imageProvider = ClipboardItemModelImageProvider(clipboardItemModel)
    engine.addImageProvider("items", imageProvider)

    context = view.rootContext()
    context.setContextProperty('clipboardItemModel', clipboardItemModel)
    context.setContextProperty('clipboardItemModelFilterProxy', filterProxyModel)
    context.setContextProperty('clipboard', clipboard)

    view.setSource(QUrl.fromLocalFile('qml/MainWindow.qml'))
    view.setGeometry(100, 100, 400, 240)
    view.show()

    engine.quit.connect(QGuiApplication.quit)

    return app.exec_()
开发者ID:hluk,项目名称:infinitecopy,代码行数:42,代码来源:infinitecopy.py

示例2: QQuickView

# 需要导入模块: from PyQt5.QtQuick import QQuickView [as 别名]
# 或者: from PyQt5.QtQuick.QQuickView import setGeometry [as 别名]
component.loadUrl(QUrl('WeatherDash.qml'))

# Create the QML user interface.  Auto creates its own engine
view = QQuickView()

engine2 = view.engine
# Does not run
#engine2.quit.connect(app.quit)

#view.setSource(QUrl('PyTest.qml'))
# To Satisfy cool-retro-term needs
view.rootContext().setContextProperty('devicePixelRatio', app.devicePixelRatio())

view.setSource(QUrl('WeatherDash.qml'))
#view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setGeometry(100, 100, 750, 480)
# ala https://pythonspot.com/pyqt5-colors/
view.setColor(QColor(0, 30, 0))

view.show()

is_full_screen = False

# technique lifted from https://stackoverflow.com/questions/19131084/pyqt5-qml-signal-to-python-slot
# and augmented from https://stackoverflow.com/questions/30586983/how-to-close-pyqt5-program-from-qml
# could refine with https://stackoverflow.com/questions/24111717/how-to-bind-buttons-in-qt-quick-to-python-pyqt-5
# not 100% ideal, but adequate and interesting
def on_quit():
    app.quit()

def on_toggle_fullscreen():
开发者ID:malachib,项目名称:dashboard.qt,代码行数:33,代码来源:main.py


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