A delegate works fine in one QTableView but not visible in an other - what might be the issue?
-
Hi,
I have a delegate which just overrides createEditor and setEditorData to create a label which displays a pixmap. This works perfectly fine in one table view in a dialog but the label isn't shown in a second, different, dialog, which uses a different QTableView with a different model but the same delegate.
- My code does call openPersistentEditor in both cases.
- createEditor in the delegate gets called and successfully creates the label.
- setEditorData is called once.
- flags() in the model returns identical values for both cases.
- The model provides the correct data (since there delegate qlabel isn't shown the qtableview displays the data as string instead and it's correct)
Any idea of what I might be missing? Some special setting in the table view which is required for delegates to be positioned correct?
-
@olowo726 said in A delegate works fine in one QTableView but not visible in an other - what might be the issue?:
but the same delegate
What does this mean? Hopefully these are two different instances:
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 -
The please provide a minimal, compilable example.
-
Sorry but I don't think you're right, see QAbstractItemView::setItemDelegate(): QAbstractItemView does not take ownership of delegate.
Please provide a minimal, compilable example.