Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Qt.io webservices
  4. QsqlTableModel.removeRow() erase row content

QsqlTableModel.removeRow() erase row content

Scheduled Pinned Locked Moved Qt.io webservices
1 Posts 1 Posters 1.9k Views
  • 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.
  • E Offline
    E Offline
    engdarkman89
    wrote on last edited by
    #1

    Hi All,
    (This is my first discussion, so forgive me if i made some posting mistakes).

    I am using QSqlTableModel to populate a QTableView with data from MySql table, this works fine, calling model.removeRow() method returns True and the selected row verticalHeaderDate changed to "!" which is fine, but the row content is erased on the view (cells become blank).

    Code
    @
    mw = QMainWindow()

    model = QSqlTableModel(None, connectionManager().getConnection())
    model.setTable("vouchertypes")
    model.setEditStrategy(model.OnManualSubmit)
    model.select()
    
    tv = QTableView(mw)
    tv.setModel(model)
    
    bt = QPushButton("Delete", mw)
    bt.clicked.connect(lambda: model.removeRow(tv.currentIndex().row()))
    mw.show()
    

    @

    Extra Informations:

    • Calling submitAll() works as expected.
    • I am using python2.7 with PyQt 4.9.4
    • This problem arise just after updating PyQt 4.8.5 to 4.9.4
    • I tried to install Python, PyQt (latest Versions) to a new machine, but the problem is persist.

    Appreciate any kind of help.

    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