Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Writing QTableWidgetItem with flagas to QDataStream
Forum Updated to NodeBB v4.3 + New Features

Writing QTableWidgetItem with flagas to QDataStream

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 189 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.
  • M Offline
    M Offline
    misantroop
    wrote on last edited by
    #1

    Read/write with QTableWidgetItem works great except on read the item has default flags. Is this a known limitation and type should be written separately and then setFlags used on read?

    Writing:

    for row in range(row_count):
        for col in range(col_count):
            item = self.ui.results_view.item(row, col)
            datastream << item
    

    Reading:

    for row in range(rows):
        self.ui.results_view.insertRow(self.ui.results_view.rowCount())
        for col in range(cols):
            item = QtWidgets.QTableWidgetItem()
            item.read(datastream)
            self.ui.results_view.setItem(row, col, item)
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From a quick look at the sources, only the values contained in the items are saved so yes, you will have to handle the flags separately.

      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
      1

      • Login

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