mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Fix unable to escape when renaming scene
Fixes https://obsproject.com/mantis/view.php?id=1443
This commit is contained in:
parent
7dc9ff0575
commit
16cc60587f
|
@ -7290,3 +7290,17 @@ void SceneRenameDelegate::setEditorData(QWidget *editor,
|
|||
if (lineEdit)
|
||||
lineEdit->selectAll();
|
||||
}
|
||||
|
||||
bool SceneRenameDelegate::eventFilter(QObject *editor, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if (keyEvent->key() == Qt::Key_Escape) {
|
||||
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor);
|
||||
if (lineEdit)
|
||||
lineEdit->undo();
|
||||
}
|
||||
}
|
||||
|
||||
return QStyledItemDelegate::eventFilter(editor, event);
|
||||
}
|
||||
|
|
|
@ -830,4 +830,7 @@ public:
|
|||
SceneRenameDelegate(QObject *parent);
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index)
|
||||
const override;
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject *editor, QEvent *event) override;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue