PDA

View Full Version : Access QDoubleSpinBox in QTableView / MyTableModel



NameRakes
8th February 2017, 05:10
MyTableModel, a subclass of QAbstractTableModel, consists entirely of doubles, and is the model for my QTableView. I have made the table editable, and I see that the QDoubleSpinBox editor is installed in the table view with 2 decimal places. I want to setDecimals(6).

The question is how and where do I access the installed editor QDoubleSpinBox so that I can change the number of decimal places?

If I cannot access the installed editor, I believe I have to subclass QStyledItemDelegate and provide QDoubleSpinBox editor in the createEditor method. Of course, set this item delegate on the QTableView cells. Please confirm.

Thanks.

anda_skoa
8th February 2017, 09:16
Yes, I think you'll have to do a custom delegate.

Cheers,
_