mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 17:38:22 +08:00
Allow to use enter/return key within list widgets to navigate (#200)
This commit is contained in:
parent
ac1f24ec77
commit
07dbfa3f96
@ -160,6 +160,11 @@ void UEFITool::init()
|
||||
connect(ui->builderMessagesListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(enableMessagesCopyActions(QListWidgetItem*)));
|
||||
connect(ui->fitTableWidget, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(scrollTreeView(QTableWidgetItem*)));
|
||||
connect(ui->messagesTabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||
|
||||
// allow enter/return pressing to scroll tree view
|
||||
ui->parserMessagesListWidget->installEventFilter(this);
|
||||
ui->finderMessagesListWidget->installEventFilter(this);
|
||||
ui->builderMessagesListWidget->installEventFilter(this);
|
||||
}
|
||||
|
||||
void UEFITool::populateUi(const QItemSelection &selected)
|
||||
@ -747,6 +752,23 @@ void UEFITool::toggleBootGuardMarking(bool enabled)
|
||||
markingEnabled = enabled;
|
||||
}
|
||||
|
||||
/* emit double click signal of QListWidget on enter/return key pressed */
|
||||
bool UEFITool::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* key = static_cast<QKeyEvent*>(event);
|
||||
|
||||
if (key->key() == Qt::Key_Enter || key->key() == Qt::Key_Return) {
|
||||
QListWidget* list = qobject_cast<QListWidget*>(obj);
|
||||
|
||||
if (list != NULL && list->currentItem() != NULL)
|
||||
emit list->itemDoubleClicked(list->currentItem());
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void UEFITool::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
if (event->mimeData()->hasFormat("text/uri-list"))
|
||||
|
@ -146,6 +146,7 @@ private:
|
||||
|
||||
bool enableExtractBodyUncompressed(const QModelIndex ¤t);
|
||||
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
Loading…
Reference in New Issue
Block a user