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. Refresh the QTableview
Qt 6.11 is out! See what's new in the release blog

Refresh the QTableview

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 10.9k Views 2 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    I have A QWidget which is split in two parts (QTreeWidget at left and QTableView) at right ..

    For each row the selected at the left , the QtableView should get updated . Could you please let me know how should I get refresh the QTableView from code , when I select any row in QTreeWidget

    // handle tree row select and fill the Error Tabel at the right
    268 void MyView::TreeSelectionChanged()
    269 {
    270 const QModelIndex index = d_TreeWidget->selectionModel()->currentIndex();
    271 QString selectedText = index.data(Qt::DisplayRole).toString();
    272 UString rowString(selectedText.toUtf8().constData());
    273 updateTable(rowString);
    274 }

    / method called to update error table when each of error type is selected in the treewidget
    259 void MyView::updateTable(UString& errorNameString) {
    260 My questions is what should be done to refresh the QTableView
    }
    265

    Please note , When I click the tableView header the view gets updated

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      If I understand correctly are you facing a problem that the viewport() is not updated ? if yes then you can call tableview->viewport()->update();

      1 Reply Last reply
      2

      • Login

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