fix(qt): Disable "Show address QR code" menu items/buttons when no qrencode support was compiled in (#4854)

This commit is contained in:
UdjinM6 2022-05-29 23:42:18 +03:00 committed by GitHub
parent 604cdbc447
commit c6b734f99c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -67,6 +67,9 @@ AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) :
ui->setupUi(this); ui->setupUi(this);
ui->showAddressQRCode->setIcon(QIcon()); ui->showAddressQRCode->setIcon(QIcon());
#ifndef USE_QRCODE
ui->showAddressQRCode->setEnabled(false);
#endif
switch(mode) switch(mode)
{ {
@ -110,6 +113,9 @@ AddressBookPage::AddressBookPage(Mode _mode, Tabs _tab, QWidget* parent) :
QAction *editAction = new QAction(tr("&Edit"), this); QAction *editAction = new QAction(tr("&Edit"), this);
QAction *showAddressQRCodeAction = new QAction(tr("&Show address QR code"), this); QAction *showAddressQRCodeAction = new QAction(tr("&Show address QR code"), this);
deleteAction = new QAction(ui->deleteAddress->text(), this); deleteAction = new QAction(ui->deleteAddress->text(), this);
#ifndef USE_QRCODE
showAddressQRCodeAction->setEnabled(false);
#endif
// Build context menu // Build context menu
contextMenu = new QMenu(this); contextMenu = new QMenu(this);
@ -269,13 +275,17 @@ void AddressBookPage::selectionChanged()
break; break;
} }
ui->copyAddress->setEnabled(true); ui->copyAddress->setEnabled(true);
#ifdef USE_QRCODE
ui->showAddressQRCode->setEnabled(true); ui->showAddressQRCode->setEnabled(true);
#endif
} }
else else
{ {
ui->deleteAddress->setEnabled(false); ui->deleteAddress->setEnabled(false);
ui->copyAddress->setEnabled(false); ui->copyAddress->setEnabled(false);
#ifdef USE_QRCODE
ui->showAddressQRCode->setEnabled(false); ui->showAddressQRCode->setEnabled(false);
#endif
} }
} }

View File

@ -157,6 +157,9 @@ transactionView(nullptr), abandonAction(nullptr), columnResizingFixer(nullptr)
QAction *editLabelAction = new QAction(tr("Edit address label"), this); QAction *editLabelAction = new QAction(tr("Edit address label"), this);
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this); QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
QAction *showAddressQRCodeAction = new QAction(tr("Show address QR code"), this); QAction *showAddressQRCodeAction = new QAction(tr("Show address QR code"), this);
#ifndef USE_QRCODE
showAddressQRCodeAction->setEnabled(false);
#endif
contextMenu = new QMenu(this); contextMenu = new QMenu(this);
contextMenu->setObjectName("contextMenu"); contextMenu->setObjectName("contextMenu");