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. Model based vs Item based
Forum Update on Monday, May 27th 2025

Model based vs Item based

Scheduled Pinned Locked Moved Solved General and Desktop
model item basedifferencestreewidget
3 Posts 2 Posters 10.3k 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.
  • Q Offline
    Q Offline
    QT-static-prgm
    wrote on 13 Feb 2017, 13:07 last edited by
    #1

    Hi,

    i need a tree widget to display some text (similar to the registry tree). The text should be selectable and i'd like to have right klick support. So if i do a right klick there appears a little context menu.

    I saw two different version in the designer:

    1. model based
    2. item based

    What is the differences and which should i select for my use??

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 13 Feb 2017, 13:48 last edited by VRonin
      #2

      Genesis 1:3

      And God said:"Use QAbstractItemModel interface". and QAbstractItemModel interface was used

      I'm a bit overly dogmatic here but that's my advice always. The QAbstractItemModel is the one the whole model-view framework relies upon so if you use that interface you are assured it will work regardless of what model and view you use it in. The QStandardItem interface only works with QStandardItemModel (either explicitly or implicitly like in Q[...]Widget classes)

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      Q 1 Reply Last reply 13 Feb 2017, 15:07
      1
      • V VRonin
        13 Feb 2017, 13:48

        Genesis 1:3

        And God said:"Use QAbstractItemModel interface". and QAbstractItemModel interface was used

        I'm a bit overly dogmatic here but that's my advice always. The QAbstractItemModel is the one the whole model-view framework relies upon so if you use that interface you are assured it will work regardless of what model and view you use it in. The QStandardItem interface only works with QStandardItemModel (either explicitly or implicitly like in Q[...]Widget classes)

        Q Offline
        Q Offline
        QT-static-prgm
        wrote on 13 Feb 2017, 15:07 last edited by
        #3

        @VRonin Amen

        1 Reply Last reply
        0

        3/3

        13 Feb 2017, 15:07

        • Login

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