[SOLVED] Listview custom delegate editTrigger problem
-
Hi,
I have a Listview with my own cutom delegate.
My custom delegate has a pushbutton which should do something.The problem is the you cannot click the pushbutton until the row of the ListView is doubleClicked which triggers edit mode.
What can I do in the listview so that I can click my pushbutton without doubleclicking the item it is in?
Regards
-
I found out the way.
You have to enable mouseTracking on the listView and use its entered(const QModelIndex & index) signal.
Connect it with a slot open the editor like:
@void MyDelegate::cell_entered(const QModelIndex &index) {
if (m_is_any_item_in_edit_mode)
m_list_view->closePersistentEditor(m_current_edited_index);
m_list_view->openPersistentEditor(index);
m_is_any_item_in_edit_mode = true;
m_current_edited_index = index;
}@