diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index c0dcfb63e8..74066b8b0c 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -33,6 +33,8 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent) : GUIUtil::updateFonts(); + GUIUtil::disableMacFocusRect(this); + ui->passEdit1->setMinimumSize(ui->passEdit1->sizeHint()); ui->passEdit2->setMinimumSize(ui->passEdit2->sizeHint()); ui->passEdit3->setMinimumSize(ui->passEdit3->sizeHint()); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 59a94a08ea..133339d905 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -65,6 +65,8 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidge GUIUtil::updateFonts(); + GUIUtil::disableMacFocusRect(this); + // context menu actions QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index dba5be2d3a..8763fae67c 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -21,6 +21,8 @@ EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) : { ui->setupUi(this); + GUIUtil::disableMacFocusRect(this); + GUIUtil::setupAddressWidget(ui->addressEdit, this); switch(mode) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 9652f67ad7..635bf1da1b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1449,6 +1449,17 @@ bool dashThemeActive() return theme != traditionalTheme; } +void disableMacFocusRect(const QWidget* w) +{ +#ifdef Q_OS_MAC + for (const auto& c : w->findChildren()) { + if (c->testAttribute(Qt::WA_MacShowFocusRect)) { + c->setAttribute(Qt::WA_MacShowFocusRect, !dashThemeActive()); + } + } +#endif +} + void setClipboard(const QString& str) { QApplication::clipboard()->setText(str, QClipboard::Clipboard); diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 991daf9d4a..b2f63d5682 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -307,6 +307,10 @@ namespace GUIUtil /** Check if a dash specific theme is activated (light/dark) */ bool dashThemeActive(); + /** Disable the OS default focus rect for macOS because we have custom focus rects + * set in the css files */ + void disableMacFocusRect(const QWidget* w); + /* Convert QString to OS specific boost path through UTF-8 */ fs::path qstringToBoostPath(const QString &path); diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 9129c8d6af..7d866e50cb 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -205,6 +205,7 @@ bool Intro::pickDataDirectory() { /* Let the user choose one */ Intro intro; + GUIUtil::disableMacFocusRect(&intro); intro.setDataDirectory(dataDirDefaultCurrent); intro.setWindowIcon(QIcon(":icons/bitcoin")); diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp index f6ff2a6c82..212d35b696 100644 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -17,6 +17,7 @@ OpenURIDialog::OpenURIDialog(QWidget *parent) : { ui->setupUi(this); GUIUtil::updateFonts(); + GUIUtil::disableMacFocusRect(this); #if QT_VERSION >= 0x040700 ui->uriEdit->setPlaceholderText("dash:"); #endif diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index e75bb21536..250510b074 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -40,6 +40,8 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : GUIUtil::updateFonts(); + GUIUtil::disableMacFocusRect(this); + /* Main elements init */ ui->databaseCache->setMinimum(nMinDbCache); ui->databaseCache->setMaximum(nMaxDbCache); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index caf8876533..3f336c030f 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -477,6 +477,8 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) : ui->banHeading }, GUIUtil::FontWeight::Bold, 16); + GUIUtil::disableMacFocusRect(this); + QSettings settings; if (!restoreGeometry(settings.value("RPCConsoleWindowGeometry").toByteArray())) { // Restore failed (perhaps missing setting), center the window diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 4f0c92d875..1b396cf907 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -23,6 +23,8 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par { ui->setupUi(this); + GUIUtil::disableMacFocusRect(this); + setCurrentWidget(ui->SendCoins); if (platformStyle->getUseExtraSpacing()) diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index 02678a46eb..c1dcb0f687 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -69,6 +69,8 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformS GUIUtil::setFont({ui->statusLabel_SM, ui->statusLabel_VM}, GUIUtil::FontWeight::Bold); GUIUtil::updateFonts(); + + GUIUtil::disableMacFocusRect(this); } SignVerifyMessageDialog::~SignVerifyMessageDialog() diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 171e39fe45..a9c3722a32 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -109,6 +109,8 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): // Pass through messages from transactionView connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int))); + + GUIUtil::disableMacFocusRect(this); } WalletView::~WalletView()