Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTreeview opened/ closeed folder icons should be displayed based on index
DonCoder last edited by
I should display closed/opened folder icons in qtreeview based on the level or based on data associated with node. SO i think stylesheet will not solve problem. How to implement it ?
JonB last edited by JonB
I haven't done it myself, but if you can't or don't want to use stylesheet here is `https://doc.qt.io/qt-5/qt.html#ItemDataRole-enum
Qt::DecorationRole1 The data to be rendered as a decoration in the form of an icon. (QColor, QIcon or QPixmap)
what is used for the folder icons? In which case adjust that in
setData()depending on index?
I don't know if it's a good example, but https://stackoverflow.com/questions/38307957/assigning-icons-to-items-in-qtreeview seems to show the principle.