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. QStandardModel::setData() doesn't update in QTreeView until tree is hidden, then shown again.
Qt 6.11 is out! See what's new in the release blog

QStandardModel::setData() doesn't update in QTreeView until tree is hidden, then shown again.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.9k 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.
  • N Offline
    N Offline
    neveralull
    wrote on last edited by
    #1

    I have a QStandardModel which I display in a QTreeView

    If I change the value in a QStandardItem which is in the QStandardModel using QStandardModel::setData(index, value), the tree doesn't show the updated value until I either click in the cell that is being updated, or click some other cell at random, or I put in the code:

    tree->setVisible(false);
    tree->setVisible(true);

    This doesn't seem right. Why doesn't setData immediately get updated in the QTreeView as soon as it is updated in the QStandardItem in the QStandardModel that the tree is showing?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      beemaster
      wrote on last edited by
      #2

      From QAbstractItemModel documentation:

      "The dataChanged() signal should be emitted if the data was successfully set.
      The base class implementation returns false. This function and data() must be reimplemented for editable models."

      Please check if dataChanged() signal is emitted. If not, you have to emit this signal

      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