Unsolved How to create editorWidget when delegate is constructed?
no editor widgets are set up when the delegate is constructed. We only construct an editor widget when it is needed.
here ,it says so.
So what if I want an editorWidget as soon as a delegate is created?
@hjohn Just construct it after creating the delegate?
What I mean is, in this QSpinBox Delegate example,when we click on particular block in the table , the QSpinBox gets created and as soon as we select some other index, it vanishes.
Is there a way to create a QSpinBox along with the Delegate where as soon as the table appears the spinBox appears too, without us clicking or attempting to edit it ? It should work as it works in the example linked above.
Do you mean that you want the spin box to be shown permanently ?
@SGaist Yes, thats exactly what I mean.
Can it be done !?
You can try with openPersistentEditor. Note that you will hit a performance penalty if your model has a big number of rows.
@SGaist Thank you
Now if there are more than one editors to add, How it knows which editor is to open in
void openPersistantEditor(const QModelIndex &index)?
That is implemented in the delegate createEditor function.