Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QTreeView - How to show custom widgets on the tree?

    General and Desktop
    3
    4
    2115
    Loading More Posts
    • 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
      kumararajas last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • K
          kumararajas @SGaist last edited by

          @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 Reply Quote 0
          • A
            alex_malyu last edited by alex_malyu

            @kumararajas said:

            QTreeView

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post