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. QSortFilterProxyModel && QSqlTableModel && QTableView, get QSqlTableModel selected row [Solved]
Forum Updated to NodeBB v4.3 + New Features

QSortFilterProxyModel && QSqlTableModel && QTableView, get QSqlTableModel selected row [Solved]

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

    Hi all,
    I have a QTableView showing a QSortFilterProxyModel that has a QSqlTableModel as its source model.

    QSortFilterProxyModel has a filter so not all row of QSqlTableModel are shown in the QTableView.

    when I click a row in the QTableView I need to get the row number in the original QSqlTableModel because I need to execute:
    @
    mySqlTableModel->removeRow(row_number);
    @

    How can I proceed?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      "QAbstractProxyModel::mapToSource() ":http://doc.qt.nokia.com/4.7/qabstractproxymodel.html#mapToSource translates the selection model's index back to the original model's index.

      [EDIT: wrong method name, mapToSource is right]

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luca
        wrote on last edited by
        #3

        [quote author="Volker" date="1309901676"]"QAbstractProxyModel::mapToSource() ":http://doc.qt.nokia.com/4.7/qabstractproxymodel.html#mapToSource translates the selection model's index back to the original model's index.

        [EDIT: wrong method name, mapToSource is right][/quote]

        Thanks Volker,
        this is what i was looking for...

        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