qml treeview 图标_PyQt5 QML treeview示例

我尝试用PyQt5.6(python3.4)和QML设置一个简单的treeview示例。我刚刚发现了一些C++例子,但是没有什么与PyQT相关的。我选择了与PyQt源代码一起使用的simpletreemodel示例并对其进行了修改(https://github.com/baoboa/pyqt5/tree/master/examples/itemviews/simpletreemodel)。在

很可能是模型出了问题。我收到两条错误信息:

simpletreemodel.qml:13:5: QML TreeView: Binding loop detected for property "model"

...qt/5.6/gcc_64/qml/QtQuick/Controls/TreeView.qml:94:16: Unable to assign [undefined] to QAbstractItemModel*

你知道发生什么事了吗?qmltreeview刚刚在qt5.5中引入,也许它在PyQt中还不能完全工作?!没有找到任何相关信息。在

这是我的代码:

在simpletreemodel.qml在import QtQuick 2.5

import QtQuick.Controls 1.4

import QtQml.Models 2.2

Rectangle {

width: 480

height: 640

TreeView {

id: treeView

anchors.fill: parent

anchors.margins: 6

anchors.top: parent.top

anchors.horizontalCenter: parent.horizontalCenter

model: model

TableViewColumn {

title: "Title"

role: "TitleRole"

resizable: true

}

TableViewColumn {

title: "Summary"

role: "SummaryRole"

resizable: true

}

}

}

在simpletreemodel.py在

^{pr2}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值