## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
##
## $QT_END_LICENSE$
##
#############################################################################

"""PySide6 port of the remoteobjects/modelviewclient example from Qt v5.x"""

import sys

from PySide6.QtCore import QUrl
from PySide6.QtWidgets import (QApplication, QTreeView)
from PySide6.QtRemoteObjects import QRemoteObjectNode

if __name__ == '__main__':
    app = QApplication(sys.argv)
    node = QRemoteObjectNode(QUrl("local:registry"))
    node.setHeartbeatInterval(1000)
    view = QTreeView()
    view.setWindowTitle("RemoteView")
    view.resize(640,480)
    model = node.acquireModel("RemoteModel")
    view.setModel(model)
    view.show()

    sys.exit(app.exec_())
示例#2
0
#!/usr/bin/env python3
"""
    【简介】
	PySide6中 QTreeView 例子


"""

import sys
from PySide6.QtWidgets import QApplication, QTreeView, QFileSystemModel
from PySide6.QtCore import QDir
from PySide6.QtGui import *

if __name__ == '__main__':
    app = QApplication(sys.argv)
    # Window系统提供的模式
    model = QFileSystemModel()

    # QFileSystemModel 只有设置了setRootPath后才会起作用。
    model.setRootPath('')
    # 创建一个QtreeView部件
    tree = QTreeView()
    # 为部件添加模式
    tree.setModel(model)
    tree.setWindowTitle("QTreeView 例子")
    tree.resize(500, 310)
    tree.show()
    sys.exit(app.exec())