mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-10-22 07:21:21 +00:00
GUI: allow delete key to remove entries from string list configuration widgets
See #3585
This commit is contained in:
parent
5adb6c7cd6
commit
d9372061ec
3
NEWS.md
3
NEWS.md
@ -9,6 +9,9 @@
|
||||
properties has been changed: the old element is now titled "Language
|
||||
(obsolete)" & the current, IETF BCP 47 based one is simply called
|
||||
"Language".
|
||||
* MKVToolNix GUI: preferences: you can now use the "delete" key to remove
|
||||
entries from simple list widgets for strings (e.g. the list of recently used
|
||||
destination directories).
|
||||
|
||||
## Bug fixes
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QInputDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QKeySequence>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpression>
|
||||
@ -35,6 +37,8 @@ StringListConfigurationWidget::StringListConfigurationWidget(QWidget *parent)
|
||||
|
||||
p->ui->pbRemoveItem->setEnabled(false);
|
||||
|
||||
p->ui->lwItems->installEventFilter(this);
|
||||
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
@ -161,4 +165,19 @@ StringListConfigurationWidget::setItemType(ItemType itemType) {
|
||||
p_func()->itemType = itemType;
|
||||
}
|
||||
|
||||
bool
|
||||
StringListConfigurationWidget::eventFilter(QObject *o,
|
||||
QEvent *e) {
|
||||
auto p = p_func();
|
||||
|
||||
if ( (o == p->ui->lwItems)
|
||||
&& (e->type() == QEvent::KeyPress)
|
||||
&& (static_cast<QKeyEvent *>(e)->matches(QKeySequence::Delete))) {
|
||||
removeSelectedItems();
|
||||
return true;
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/common_pch.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
@ -47,6 +48,8 @@ public:
|
||||
|
||||
void addItem(QString const &name);
|
||||
|
||||
virtual bool eventFilter(QObject *o, QEvent *e) override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void enableControls();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user