Reputation: 968
Here is part of my code:
cell = QtWidgets.QTableWidgetItem()
cell.setData(QtCore.Qt.EditRole, dics[0][key])
self.data_row_selection_table.setItem(row, nmr_analysis.QT_DATA_COLUMN_ENTRIES.index(key), cell)
the application appears like
But when I edit the cell, the number's accuracy is limited to centile:
How to change the displayed precision of the numbers as well as the limited accuracy during edit?
Upvotes: 1
Views: 1340
Reputation: 10859
One way is to make your own model (derived from QAbstractTableModel
) and then in the data
method convert floating point numbers to the desired precision with '{.xf}'.format(number)
or similar. This should also lift the edit restrictions.
When you retrieve the data from the model you would have to convert to numbers again.
Upvotes: 2