Reputation: 33607
I've subclassed a QTreeView
and have overriden keyPresseEvent()
to do stuff when certain keys are pressed. Naturally, I don't want to do that while an item is being edited. How can I check if editing is in progress or not?
Upvotes: 2
Views: 1783
Reputation: 96
you can check the view's internal state to see if it is in editing state
if (my_treeview->state() != QAbstractItemView::EditingState)
{
/* do some stuff */
}
Upvotes: 4
Reputation: 10979
You can use these functions. If edit
is called but closeEditor
or editorDestroyed
is not called yet, it is in editing mode.
bool QAbstractItemView::edit ( const QModelIndex & index, EditTrigger trigger, QEvent * event ) [virtual protected]
void QAbstractItemView::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ) [virtual protected slot]
void QAbstractItemView::editorDestroyed ( QObject * editor ) [virtual protected slot]
Upvotes: 2