Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAbstractItemModel - Am i doing it right?
Qt 6.11 is out! See what's new in the release blog

QAbstractItemModel - Am i doing it right?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 474 Views 1 Watching
  • 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.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    Hi
    I have just started with QAbstractItemModel and have some doubts as to whether I am doing things in the correct way.

    I have class that (amongst other things) is storing a set of data that I want to display in a QTreeView.
    So I made a model class derived from QAbstractItemModel and have then attached this model to my QTreeView which does show the data correctly and allows the user to edit the values.
    As expected when an edit is completed my setData method gets called and I can set the relevant items data.
    However, this does not update the underlying data and I am struggling to see how this is done.

    I would be grateful if someone could
    a) confirm that I am doing things correctly
    b) explain how the underlying data is typically updated

    Thanks

    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
    • Unsolved