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. Edit QStandardItem text remote when using proxyfiltermodel to filter data
Forum Updated to NodeBB v4.3 + New Features

Edit QStandardItem text remote when using proxyfiltermodel to filter data

Scheduled Pinned Locked Moved General and Desktop
qproxyfiltermod
2 Posts 1 Posters 687 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.
  • A Offline
    A Offline
    andsun
    wrote on last edited by
    #1

    Hi, I can't figure out how to change the text in my QTableView from code when I'm using a proxy filter.
    Any help is appreciated

    I am using a QTableView to hold a large amount of data within a QStandardItemModel.
    I'm using a combobox to let the user filter the data to manageable size and a QProxyFilterModel to do the actual filtering.
    Now when I want to change the filtered data with code, I don't understand how to get the say first filtered row and third column item to set new data to.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andsun
      wrote on last edited by
      #2

      By pure chance did I find this, and after my modification, and it seems to work
      ui->tblView->model()->setData(ui->tblView->model()->index(1,4,QModelIndex()), QString("Testar"), Qt::EditRole);

      So if I got this right, since I set my QTableView Model to the proxymodel and filter with. The above tblView->model() returns the result from the filter as a model....
      Also, using ->setData let min change the data as long as I'm using the QStandardItem in my model plus using Qt::EditRole.

      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