Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QsqlTableModel.removeRow() erase row content

    Qt.io webservices
    1
    1
    1789
    Loading More Posts
    • 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
      engdarkman89 last edited by

      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 Reply Quote 0
      • First post
        Last post