Is there a way of getting the editor (a QLineEdit instance) while the editing is in progress?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The delegate creates the editing widget, but does not store it and the view does not give access to it (presumably because it is not persistent).
So you will have to subclass
QStyledItemDelegateand reimplementcreateEditor(QWidget*, const QStyleOptionViewItem&, const QModelIndex&) constto store a copy of the returned pointer. Then you can provide access to the editor through the delegate.AFAIK you cannot create multiple editors at once in a single view, and delegate sharing across views is discouraged, so holding the last created editor should be sufficient. I would also create a private slot that nulls the pointer and connect it to the destroyed signal of the created editor – so you know it is always valid.