mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
qt: Disable macOS system focus rectangles for dash themes (#3556)
* qt: Disable macOS system focus rectangles for dash themes The focus rects drawn by macOS are in the color the user selected in the OS settings as selection color. This just doesn't always fit into the coloring of the dash specific themes. * Apply review suggestion Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
d296cbdca1
commit
067622764c
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -21,6 +21,8 @@ EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
GUIUtil::disableMacFocusRect(this);
|
||||
|
||||
GUIUtil::setupAddressWidget(ui->addressEdit, this);
|
||||
|
||||
switch(mode)
|
||||
|
@ -1449,6 +1449,17 @@ bool dashThemeActive()
|
||||
return theme != traditionalTheme;
|
||||
}
|
||||
|
||||
void disableMacFocusRect(const QWidget* w)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
for (const auto& c : w->findChildren<QWidget*>()) {
|
||||
if (c->testAttribute(Qt::WA_MacShowFocusRect)) {
|
||||
c->setAttribute(Qt::WA_MacShowFocusRect, !dashThemeActive());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void setClipboard(const QString& str)
|
||||
{
|
||||
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -23,6 +23,8 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
GUIUtil::disableMacFocusRect(this);
|
||||
|
||||
setCurrentWidget(ui->SendCoins);
|
||||
|
||||
if (platformStyle->getUseExtraSpacing())
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user