Reputation: 103
I want to use my own delegates for filtering user input in some columns of QTableWidget. According to the QAbstractItemView class reference I need to delete delegates myself.
I don't want to create and delete them every time when I change structure of the table. It would be fine to use the same delegate in all columns that need to be validated. But the reference doesn't recommend to share the same delegate between views:
Warning: You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.
Obviously, only one instance of editor can be shown in QTableWidget at the same time.
Is it correct to share the same delegate between columns?
Upvotes: 1
Views: 170
Reputation: 2939
You will only have one editor open at the same time for a single view, so from a closeEditor signal perspective, it should be safe.
Upvotes: 1