OK, here is the answer I came up with by myself:
self.
tableView.
setItem(i,
2,
QTableWidgetItem(str
(create_dataframe
(res
)[2][i
])))it3.
setData(Qt.
EditRole,
QVariant(create_dataframe
(res
)[3][i
]))self.tableView.setItem(i, 3, it3)
self.tableView.setItem(i, 2, QTableWidgetItem(str(create_dataframe(res)[2][i])))
it3 = QTableWidgetItem()
it3.setData(Qt.EditRole, QVariant(create_dataframe(res)[3][i]))
self.tableView.setItem(i, 3, it3)
To copy to clipboard, switch view to plain text mode
I.e. there is no need to transform datetime value: it can be properly sorted in string form. As for integer values, I have to create an instance of QTableWidgetItem(), then use .setData with QVariant on it. After this I can setItem to the table.
Bookmarks