QTableWidgetItem and formatting / input masks
I have a QTableWidget and for the contained QTableWidgetItem I need...
- to set input masks
- to format the displayed numbers correctly (e.g. 17.40 or 17,40)
But there is no setInputMask() available for a QTableWidgetItem?
How to format the numbers both during input and during displaying?
Thanks a lot!
Re: QTableWidgetItem and formatting / input masks
Nobody? So is it not possible and I have to derive my own classes? :(
Re: QTableWidgetItem and formatting / input masks
You might try to subclass QItemDelegate and reimplement QItemDelegate::createEditor() to make it set an input mask on the line edit. This should be enough, since QTableWidgetItems keep data as strings, so they won't reformat them after editing.
Re: QTableWidgetItem and formatting / input masks
Thanks.
I am a bit disapointed that I have to code such a simple feature myself. I am just starting to learn Qt and sometimes it seems a bit... eh... low-ended