Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Input mask for QTableWidgetItem and QTreeWidgetItem
I have QTreeWidget with multiple column . I want input mask for some columns in QTreeWidget i.e. for column number 3 only double values. Is there any way to implement this. I tried using QLineEdit widget and QDoubleValidator but i don't want to use QLineEdit in column. If you have any suggestions how to implement this please let me know.
Thank you !
You can do that by creating a custom QStyledItemDelegate that uses a QDoubleSpinBox as editor
@SGaist Thank you !
this is the best to implement above problem but as got your answer i got new requirement from user as follow.
There will be a column containing QComboBox and as per comboBox selection other column inputs mask will be changed in particular row.
input mask will be integer and double with ranges. Therefore different validator (at least 4) for different ComboBox selection.
Therefore i want generic way to implement input masks for columns.
Thank you in advance .
You're requirements are not clear at all. There's a mix between a table view, a custom widget showing database entries or maybe something else. If you are not using one of the item views then you are free to setup your input as you want. If these are only numbers then you have both QSpinBox and QDoubleSpinBox.
@SGaist Thank You !