QTreeview opened/ closeed folder icons should be displayed based on index
-
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 ?
@DonCoder
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-enumQt::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
data()orsetData()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.