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


Python QDeclarativeView.engine方法代码示例

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


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

示例1: run

# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import engine [as 别名]
  def run(self):
    app = QApplication(sys.argv)
    imageProvider = ImageProvider()

    # Create the QML user interface.
    view = QDeclarativeView()
    
    view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

    engine = view.engine()
    
    engine.addImageProvider("mazakodron", imageProvider)
    
    view.setSource(QUrl('symulator/mazakodron.qml'))
    rootObject = view.rootObject()
    if not rootObject:
      view.setSource(QUrl('mazakodron.qml'))
      rootObject = view.rootObject()
    
    rootObject.requestDraw.connect(imageProvider.draw)
    
    self.rootObject = rootObject

    view.setGeometry(0, 0, 800, 600)
    view.show()

    timer = QTimer()
    timer.start(1000/60) # 60FPS
    timer.timeout.connect(self.process)

    sys.exit(app.exec_());
开发者ID:mazakodron,项目名称:symulator,代码行数:33,代码来源:symulator.py

示例2: main

# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import engine [as 别名]
def main():
	os.chdir(sys.path[0])
	app = QApplication(sys.argv)
	canvas = QDeclarativeView()
	canvas.setFixedSize(360, 500)
	canvas.setWindowTitle('Ubezee - Lock Your System')
	icon = QIcon()
	icon.addPixmap(QPixmap('qml/images/UbezeeIcon.png'), QIcon.Normal, QIcon.Off)
	canvas.setWindowIcon(QIcon(icon)) 
	qr = canvas.frameGeometry()
	cp = QDesktopWidget().availableGeometry().center()
	qr.moveCenter(cp)
	canvas.move(qr.topLeft())
	engine = canvas.engine()

	element = MyElement()
	
	engine.rootContext().setContextObject(element)
	canvas.setSource(QUrl.fromLocalFile('qml/Ubezee.qml'))
	engine.quit.connect(app.quit)
	canvas.setResizeMode(QDeclarativeView.SizeRootObjectToView)
	canvas.show()
	sys.exit(app.exec_())
开发者ID:kurokid,项目名称:Ubezee,代码行数:25,代码来源:ubezee.py

示例3: QApplication

# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import engine [as 别名]
home = path.expanduser("~")

app = QApplication(sys.argv)
app.setGraphicsSystem("raster")
app.setWindowIcon(QIcon('qml/img/encode.png'))

defaultBgColor=app.palette().color(QPalette.Window).name()
Plasma.Theme.defaultTheme().setUseGlobalSettings(False)
Plasma.Theme.defaultTheme().setThemeName("AirNeptune")
#Plasma::Theme::defaultTheme()->setUseGlobalSettings(false); //don't change every plasma theme!
#Plasma::Theme::defaultTheme()->setThemeName("appdashboard");

# Create the QML user interface.
view = QDeclarativeView()
# Use PlasmaComponents
engine = view.engine()
engine.addImportPath("/usr/lib/kde4/imports")
# Set main qml here
view.setSource(QUrl("3ncode.qml"))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

# Get the root object of the user interface.
rootObject = view.rootObject()

# Set default background
rootObject.setBgColor(defaultBgColor)

# Check for parameters
if len(sys.argv) > 1:
  openF(str(sys.argv[1]).decode('utf-8'))
开发者ID:,项目名称:,代码行数:32,代码来源:

示例4: QApplication

# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import engine [as 别名]
                if size is not None:
                        size = self.gameMap.size
                if 'background' in id:
                        return self._requestBackground(id)
                elif 'attack' in id:
                        return self._requestAttack(id)

app = QApplication(sys.argv)
if len(app.arguments()) > 1:
    mapName = app.arguments()[1]
else:
    mapName = 'world'

view = QDeclarativeView()
provider = MapImageProvider(mapName)
view.engine().addImageProvider('map', provider)
view.setSource(QUrl('main.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

root = view.rootObject()

for country in xrange(1, provider.gameMap.countries + 1):
        x, y = provider.gameMap.center[country]
        root.addCountry.emit(country, x, y)

provider.setPlayerColor(1, QColor(Qt.green))
provider.setPlayerColor(2, QColor(Qt.red))
provider.setPlayerColor(3, QColor(Qt.blue))
for country in xrange(1, provider.gameMap.countries + 1):
        player = random.randint(1, 3)
        color = provider.gameMap.color[player].darker()
开发者ID:tonylim512,项目名称:distributed-risk,代码行数:33,代码来源:main.py


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