Search code examples
qtqt-creatorqtreeviewqstandarditemmodel

How to assign different Url to my TreeView Items


I am new to Qt. I had created a Qtree View using QStandard item model. Now I want to set Url to my items. How can I assign url for tree view items.


Solution

  • you can use setData API of QStandardItem, with user defined role for storing URL.

    void QStandardItem::setData ( const QVariant & value, int role = Qt::UserRole + 1 )