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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.