Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeview opened/ closeed folder icons should be displayed based on index

QTreeview opened/ closeed folder icons should be displayed based on index

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 171 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DonCoderD Offline
    DonCoderD Offline
    DonCoder
    wrote on last edited by
    #1

    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 ?

    JonBJ 1 Reply Last reply
    0
    • DonCoderD DonCoder

      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 ?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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-enum

      Qt::DecorationRole 1 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() or 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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved