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
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 178 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.
  • D Offline
    D Offline
    DonCoder
    wrote on 25 Jan 2021, 13:32 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 ?

    J 1 Reply Last reply 25 Jan 2021, 13:42
    0
    • D DonCoder
      25 Jan 2021, 13:32

      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 ?

      J Online
      J Online
      JonB
      wrote on 25 Jan 2021, 13:42 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

      1/2

      25 Jan 2021, 13:32

      • Login

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