Hyperlinks in QTreeView

2019-08-05 09:40发布

I'm trying to display clickable links within a QTreeView. I've created my own QStyledItemDelegate, and I can draw text that looks like a link, but isn't clickable like a link would be.

One option I'm thinking of is creating a QLabel with a link, and drawing the QLabel inside the QTreeView cells. The only problem is that I can't figure out how to add QLabels to the QTreeView.

Any ideas?

1条回答
劫难
2楼-- · 2019-08-05 09:58

Have you checked out QAbstractItemView::setIndexWidget? You could create a QLabel like you said and pass it this function for the correct index.

查看更多
登录 后发表回答