Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. BeginResetModel () and endResetModel () doesn’t work when data contained in QStringListModel changed
Forum Updated to NodeBB v4.3 + New Features

BeginResetModel () and endResetModel () doesn’t work when data contained in QStringListModel changed

Scheduled Pinned Locked Moved Language Bindings
3 Posts 3 Posters 1.6k 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.
  • R Offline
    R Offline
    redstoneleo
    wrote on last edited by
    #1

    beginResetModel () and endResetModel () doesn’t work when data contained in QStringListModel changed in my code here ,anyone can explain why ?

    @
    import sys

    from PyQt4.QtGui import *
    from PyQt4.QtCore import *

    class BoxLayout(QWidget):
    def init(self, parent=None):
    QWidget.init(self, parent)

        self.view = QTableView()
        hbox = QHBoxLayout()
        hbox.addWidget(self.view)
        self.setLayout(hbox)
        self.resize(800, 600)
    
        self.lst=[]
        self.stringListModel=QStringListModel (self.lst)
        self.view.setModel(self.stringListModel)
        
        self.timer = QTimer(self);
        self.timer.timeout.connect(self.timerHit)
        self.timer.start(1000)
        
    def timerHit(self):
        self.stringListModel.beginResetModel ()
        
        self.lst.append(QTime.currentTime().toString())
        #self.stringListModel.setStringList(self.lst)
        self.stringListModel.endResetModel ()
    

    app = QApplication(sys.argv)
    qb = BoxLayout()
    qb.show()
    sys.exit(app.exec_())

    @

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please don't post the same thread in multiple sub-forum

      "Duplicate":http://qt-project.org/forums/viewthread/34158/

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        Closed for duplication

        Vote the answer(s) that helped you to solve your issue(s)

        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