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. QWidget in QTreeView with Model

QWidget in QTreeView with Model

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.9k 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
    dodo
    wrote on last edited by
    #1

    hi
    i want to use my own QWidget in a QTreeView.
    QTreeWidget::setItemWidget is what i'm already using, which works fine, but doesn't play very well with a QAbstractItemModel.

    so is there a possability to use a QTreeView with data coming from a QAbstractItemModel and showen in a QWidget?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tbscope
      wrote on last edited by
      #2

      You might want to use a delegate.
      Examples:
      http://doc.qt.nokia.com/4.7-snapshot/itemviews-spinboxdelegate.html
      http://doc.qt.nokia.com/4.7-snapshot/itemviews-stardelegate.html

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dodo
        wrote on last edited by
        #3

        so you mean i should use QItemDelegate::createEditor and flag every entry with Qt::EditRole?

        i dont think i can use a delegate because the normal way would be to use QItemDelegate::paint to display the data, but i got buttons and everything in my widget and just render them as pixmap is .. well not my goal.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tbscope
          wrote on last edited by
          #4

          And what about this?
          http://doc.qt.nokia.com/4.7/qabstractitemview.html#setIndexWidget

          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