Conversation
Such shortcuts are useless as pressing the Alt key closes a context menu widget immediately.
This overloaded function was introduced in Qt 5.6 and makes code more concise.
src/qt/addressbookpage.cpp
Outdated
| contextMenu->addAction(editAction); | ||
| if(tab == SendingTab) | ||
| if (tab == SendingTab) { | ||
| QAction* deleteAction = new QAction(ui->deleteAddress->text(), this); |
There was a problem hiding this comment.
With this change, the delete action only shows up on the sending tab where before it would be disabled in the receiving tab. I prefer this approach since the context menu is consistent for all addresses in each tab. I would prefer the other approach if the context menu actions were different on each row.
| connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction); | ||
|
|
||
| connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu); | ||
|
|
|
@hebasto Ready for merge? |
jarolrod
left a comment
There was a problem hiding this comment.
ACK 16c157d
Tested that we maintain the same shortcuts between master and this PR and that the functionality is the same.
The use of this overloaded addAction is correct and fits with our minimum supported Qt version: https://doc.qt.io/archives/qt-5.9/qmenu.html#addAction-4
This is a nice simplification, the use of this overloaded function makes adding new context menu actions easier.
e4c916a Bugfix: GUI: Use a different shortcut for "1 d&ay" banning, due to conflict with "&Disconnect" (Luke Dashjr) 94e7cdd GUI: Add keyboard shortcuts for other context menus (Luke Dashjr) 02b5263 GUI: Restore keyboard shortcuts for context menu entries (Luke Dashjr) Pull request description: Various keyboard shortcuts were lost in #263; this restores them, and also adds new ones for other context menus. Note that with a context menu open, simply the shortcut by itself (no Alt) is used. ACKs for top commit: jarolrod: Code Review ACK e4c916a hebasto: ACK e4c916a, tested on Linux Mint 20.1 (Qt 5.12.8). Tree-SHA512: 949461acf7aac592bc48a1c5abad41b167365830e0cedb3aa11b6a87bd347e16126830ea87936f9c9efc4b7df5b09d3833fae784964d6d119ed45703cfba2ffd
This PR:
Alt+<KEY>shortcuts from context menu itemsQMenu::addActionfor each context menu item (it became possible since build: Bump minimum Qt version to 5.9.5 bitcoin/bitcoin#21286 was merged)No behavior change.