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


Python QtDeclarative.QDeclarativeView类代码示例

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


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

示例1: QmlGameFrame

class QmlGameFrame(QMainWindow):
    
    def __init__(self, parent = None) :
        '''
        Constructor
        '''
        super(QmlGameFrame, self).__init__(parent)
        
        layout = QVBoxLayout()
        
        self.view = QDeclarativeView(self)

        layout.addWidget(self.view)
        self.setLayout(layout)
                
        self.geoMap = GeoMap()
        #self.model.connect()
        
        #self.noteList = self.model.getNoteList()
        #self.noteList = self.model.getToDoList()
        
        
        
        rootContext = self.view.rootContext()
        rootContext.setContextProperty('geoMap', self.geoMap)
                
        path = QDir.currentPath() + '/../../qml/SimpleQmlGameEngine/main.qml'
        path = path.replace('users', 'Users')
        print path
        url = QUrl(path)
        #url = QUrl('file:///Users/unseon_pro/myworks/SimpleQmlGameEngine/qml/SimpleQmlGameEngine/main.qml')
        self.view.setSource(url)
开发者ID:flexdimension,项目名称:SimpleQmlGameEngine,代码行数:32,代码来源:QmlGameFrame.py

示例2: OverlayWidget

class OverlayWidget(QtGui.QWidget):
    
    def __init__(self, *args):
        super(OverlayWidget, self).__init__(*args)
        
        # Set this widget itself to be transparent
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        # We need to set the base colour of the qml widget to be transparent.
        # This is done by setting its palette.
        palette = QtGui.QPalette()
        palette.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)

        self.setPalette(palette)
        
        
        self.qml_view = QDeclarativeView(self)
        self.qml_view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.qml_view.setPalette(palette)
        self.qml_view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        url = QUrl('dynamic_drawers.qml')
        self.qml_view.setSource(url)
    
    def resizeEvent(self, event):
        self.qml_view.resize(event.size())
开发者ID:hgomersall,项目名称:Blog-Code,代码行数:26,代码来源:dynamic_drawer_test.py

示例3: testSignalEmission

    def testSignalEmission(self):
        qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem")

        view = QDeclarativeView()
        view.setSource(QUrl.fromLocalFile(adjust_filename('bug_951.qml', __file__)))

        self.app.exec_()
        self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED)
开发者ID:Hasimir,项目名称:PySide,代码行数:8,代码来源:bug_951.py

示例4: __init__

    def __init__(self, parent = None):
        super(Application, self).__init__(parent)

        self.handler = DocumentXmlHandler()

        ## Set values for the store/restore settings system
        QtCore.QCoreApplication.setOrganizationName("EMR")
        QtCore.QCoreApplication.setOrganizationDomain("code.rutger.no")
        QtCore.QCoreApplication.setApplicationName("QmlChatClient")

        ## create settings
        self.__settings = QtCore.QSettings()
        hostname = self.__settings.value("QmlChatClient/hostname")
        if hostname != None:
            self.__hostname = hostname
        portnumber = self.__settings.value("QmlChatClient/portnumber")
        if portnumber != None:
            self.__portnumber = portnumber

        ## Connect the socket's signals to our slots
        self.__socket.connected.connect(self.__socketConnected)
        self.__socket.disconnected.connect(self.__socketDisconnected)
        self.__socket.error.connect(self.__socketError)
        self.__socket.readyRead.connect(self.__readyRead)
        #self.__socket.stateChanged.connect(self.__socketStateChanged)

        userpassModel = UsernamePasswordModel()
        userpassModel.setHost(self.__hostname)
        userpassModel.setPort(int(self.__portnumber))

        userpassModel.connectSignal.connect(self.__connectToSystem)
        userpassModel.cancelSignal.connect(self.quitSlot)

        self.loginView = QDeclarativeView()
        self.loginView.rootContext().setContextProperty("model", userpassModel)
        self.loginView.setSource(QUrl('qml/client/LoginDialog.qml'))
        self.loginView.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        self.loggedInModel = LoggedInModel()
        self.loggedInModel.disconnectSignal.connect(self.__disconnectFromHost)
        self.loggedInModel.setHeight(self.__height)
        self.loggedInModel.setWidth(self.__width)
        self.loggedInModel.sendMessageSignal.connect(self.__sendMessage)


        self.loggedInView = QDeclarativeView()
        self.loggedInView.rootContext().setContextProperty("model", self.loggedInModel)
        self.loggedInView.setSource(QUrl('qml/client/RunningDialog.qml'))
        self.loggedInView.setResizeMode(QDeclarativeView.SizeRootObjectToView)

        self.stackedWidget = QtGui.QStackedWidget()
        self.stackedWidget.addWidget(self.loginView)
        self.stackedWidget.addWidget(self.loggedInView)
        self.stackedWidget.setCurrentWidget(self.loginView)

        self.stackedWidget.setWindowTitle('Qml Chat Client')
        self.stackedWidget.setGeometry(300, 300, self.__width, self.__height)
        self.stackedWidget.show()
开发者ID:freepax,项目名称:PysideSocketSkeletons,代码行数:58,代码来源:QmlChatClient.py

示例5: __init__

 def __init__(self, modules_path):
     QDeclarativeView.__init__(self)
     self.module = Module(modules_path)
     context = self.rootContext()
     print self.module.modules
     context.setContextProperty('plugins', self.module.toDict())
     self.setSource(QUrl('ui/qml/ScriptChooser.qml'))
     self.rootObject().scriptSelected.connect(self.onScriptSelected)
     self.__lock = Lock()
开发者ID:antiface,项目名称:DSP-Tool,代码行数:9,代码来源:ScriptSelector.py

示例6: __init__

 def __init__(self, *args, **kwargs):
     QDeclarativeView.__init__(self, *args, **kwargs)
     context = self.rootContext()
     context.setContextProperty('menu', self)
     map_file = settings.value('map')
     if not map_file:
         map_file = glob('maps/*json')[0]
     self.selected_map = map_file
     self.setSource('menu.qml')
     self.setResizeMode(QDeclarativeView.SizeRootObjectToView)
     self.rootObject().initial_map(Map.read_spec(map_file)['title'])
开发者ID:nvbn,项目名称:findZbomb,代码行数:11,代码来源:game.py

示例7: QmlGui

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())
开发者ID:gtrs,项目名称:advancedcaching,代码行数:31,代码来源:qmlgui.py

示例8: create

    def create(self, mimeType, url, argumentNames, argumentValues):
        if mimeType != 'application/x-qml':
            return None

        for name, value in zip(argumentNames, argumentValues):
            if name == 'width':
                width = int(value)
            elif name == 'height':
                height = int(value)

        view = QDeclarativeView()
        view.resize(width, height)
        view.setSource(url)

        return view
开发者ID:AmerGit,项目名称:Examples,代码行数:15,代码来源:main.py

示例9: testReturnPolicy

    def testReturnPolicy(self):
        view = QDeclarativeView()

        item1 = QDeclarativeItem()
        item1.setObjectName("Item1")
        view.scene().addItem(item1)
        self.assertEqual(item1.objectName(), "Item1") # check if the item still valid

        item2 = QDeclarativeItem()
        item2.setObjectName("Item2")
        item1.scene().addItem(item2)
        item1 = None
        self.assertEqual(item2.objectName(), "Item2") # check if the item still valid

        view = None
开发者ID:Hasimir,项目名称:PySide,代码行数:15,代码来源:bug_915.py

示例10: __init__

    def __init__(self, *args):
        super(OverlayWidget, self).__init__(*args)
        
        # We need to set the base colour of the qml widget to be transparent.
        # This is done by setting its palette.
        palette = QtGui.QPalette()
        palette.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)

        qml_view = QDeclarativeView(self)
        qml_view.setPalette(palette)

        url = QUrl('control_slides.qml')
        qml_view.setSource(url)

        return
开发者ID:hgomersall,项目名称:Blog-Code,代码行数:15,代码来源:overlay_widget_simple.py

示例11: __init__

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        # Create the Qt Application
        self.app = QApplication(["Prey-Config"])
        self.app.setWindowIcon(QIcon(''))
        self.view = QDeclarativeView()
        #self.setWindowTitle("Main Window")

        #get rootContext of QDeclarativeView
        self.context = self.view.rootContext()
        #make this class available to QML files as 'main' context
        self.context.setContextProperty('main', self)
        #create variables
        self.curVars = Vars()
        #make curVars available to QML files as 'vars' context
        self.context.setContextProperty('vars', self.curVars)
        # QML resizes to main window
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        # Renders './qml/main.qml'
        self.view.setSource(QUrl.fromLocalFile('./qml/main.qml'))
        #get rootObject
        self.rootO = self.view.rootObject()

        #connect quit signal
        self.view.engine().quit.connect(self.quit_app)

        #check for prey installation, write acess to config file, and configurationstatus
        if self.prey_exists():
            if self.is_config_writable():
                self.get_current_settings()
                if self.check_if_configured() == False:
                    self.rootO.show_alert('Welcome!',"It seems this is the first time you run this setup. Please set up your reporting method now, otherwise Prey won't work!",False)
开发者ID:student4life,项目名称:meePrey,代码行数:32,代码来源:prey-config.py

示例12: DiffView

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
开发者ID:RomanSaveljev,项目名称:raptor,代码行数:32,代码来源:sbv.py

示例13: LogView

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
开发者ID:RomanSaveljev,项目名称:raptor,代码行数:29,代码来源:sbv.py

示例14: testAbstractItemModelTransferToQML

 def testAbstractItemModelTransferToQML(self):
     view = QDeclarativeView()
     view.setSource(QUrl.fromLocalFile(adjust_filename('bug_814.qml', __file__)))
     root = view.rootObject()
     model = ListModel()
     root.setProperty('model', model)
     view.show()
开发者ID:Hasimir,项目名称:PySide,代码行数:7,代码来源:bug_814.py

示例15: show

    def show(self,qml_file):
        self.app=QApplication([])
        self.view=QDeclarativeView()
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.view.setSource(QUrl(qml_file))
        self.ctxt = self.view.rootContext()
        self.cmd.ctxt = self.ctxt
        self.ctxt.setContextProperty("cmd", self.cmd)
        self.cmd.finish.connect(self.view.rootObject().finish)
        #self.ctxt.setContextProperty("dist", self.cmd.abort())

        self.view.show()
        self.app.exec_()
开发者ID:xkoralsky,项目名称:goldsprints,代码行数:13,代码来源:qtclient.py


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