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 - How to show custom widgets on the tree?

QTreeView - How to show custom widgets on the tree?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.7k 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.
  • K Offline
    K Offline
    kumararajas
    wrote on last edited by
    #1

    Hello,

    What should I do, if I want to show my own widget in place of tree item text in the QTreeView.

    Example - I want to show a push button in place of text show in the tree item.

    I visualize this as a QItemDelegate.

    But, not having a good grip on that.

    Any examples?

    Thanks,
    Kumara

    --Kumar

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Should this widget be shown on special circumstances or all the time ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Should this widget be shown on special circumstances or all the time ?

        K Offline
        K Offline
        kumararajas
        wrote on last edited by
        #3

        @SGaist This custom widget to be shown only on special situations, as you mentioned. And also on specific branches. Not always, not everywhere.

        --Kumar

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alex_malyu
          wrote on last edited by alex_malyu
          #4

          @kumararajas said:

          QTreeView

          void QAbstractItemView::setIndexWidget(const QModelIndex & index, QWidget * widget)
          QWidget * QAbstractItemView ::indexWidget(const QModelIndex & index) const

          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