[Interest] Persistence of editor for openPersistentEditor

Patrick Stinson patrickkidd at gmail.com
Wed Jun 6 05:48:18 CEST 2018


That is logically consistent, though it didn’t work for me. findChildren<QComboBox*>() still returns two objects. strange.

> On Jun 5, 2018, at 3:42 AM, william.crocker at analog.com wrote:
> 
> On 06/04/2018 05:08 PM, Patrick Stinson wrote:
>> Hello!
>> 
>> I am writing a unit test for an item view and need to get . The code in
>> *qabstractitemview_p.h* “releases” an editor created by a delegate by calling
>> *QObject::deleteLater()* on it. However, in the following code the first editor
>> is not deleted and so the second call to findChild still returns it instead of
>> the second editor:
>> 
>> view->openPersistentEditor(indexA)
>> editorA = view->findChild<QComboBox *cb>()
>> view->closePersistentEditor(indexA)
>> 
> 
> Here I typically  qApp->sync  and  qApp->processEvents (or so.)
> Which provide the "later" context.
> 
>> view->openPersistentEditor(indexB)
>> editorB = view->findChild<QComboBox *cb>()
>> view->closePersistentEditor(indexB)
>> 
>> // editorB == editorA !!
>> 
>> I am using a custom delegate which does not implement destroyEditor(), so
>> deleteLater should be called here. Am I missing something?
>> 
>> Thanks!
>> 
>> 
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list