Hello Roberts,
I had passing through all the problems that you described here. Since the beggining when I was looking for a solution the search always bring me here to this topic. It seems that is the only place in the whole internet that have usefull information about QtPropertyBrowser.
The problem of the behavior of the ESC key was not the hardest problem that I had to solve, since I was working a lot in the events to make the browser works for other tasks, but still is not an easy solution.
The class QtPropertyEditorDelegate creates the editor and install an event filter, so you can catch the ESC event here:
bool QtPropertyEditorDelegate
::eventFilter(QObject *object,
QEvent *event
) {
if ( e->key() == Qt::Key_Escape ) {
QtProperty* property = m_editorPrivate->currentItem()->property();
property->propertyManager()->abort(property);
}
}
bool QtPropertyEditorDelegate::eventFilter(QObject *object, QEvent *event)
{
if ( e->key() == Qt::Key_Escape ) {
QtProperty* property = m_editorPrivate->currentItem()->property();
property->propertyManager()->abort(property);
}
return QItemDelegate::eventFilter(object, event);
}
To copy to clipboard, switch view to plain text mode
In my case I used the property manager to handle with that. But you need to set the old value in the editor and not in the model, since you will let the event propagates and the QItemDelegate will worry about the post events and the behavior of the grid.
I know that it is too late to help you but maybe it can help someone.
Bookmarks