From: tobtoht Date: Thu, 28 Oct 2021 17:50:18 +0000 (+0200) Subject: macOS: fix statusbar button clickability X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=d68496bdd48a11702ebfc1940162fed2446bc5d4;p=gamesguru%2Ffeather.git macOS: fix statusbar button clickability --- diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index bced3c9c..0dfcbb0d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -95,6 +95,10 @@ void MainWindow::initStatusBar() { this->statusBar()->setStyleSheet("QStatusBar::item {border: None;}"); #endif +#if defined(Q_OS_MACOS) + this->patchStylesheetMac(); +#endif + this->statusBar()->setFixedHeight(30); m_statusLabelStatus = new QLabel("Idle", this); @@ -849,6 +853,10 @@ void MainWindow::skinChanged(const QString &skinName) { m_windowManager->changeSkin(skinName); ColorScheme::updateFromWidget(this); this->updateWidgetIcons(); + +#if defined(Q_OS_MACOS) + this->patchStylesheetMac(); +#endif } void MainWindow::updateWidgetIcons() { @@ -1586,6 +1594,14 @@ bool MainWindow::verifyPassword() { return true; } +void MainWindow::patchStylesheetMac() { + auto patch = Utils::fileOpenQRC(":assets/macStylesheet.patch"); + auto patch_text = Utils::barrayToString(patch); + + QString styleSheet = qApp->styleSheet() + patch_text; + qApp->setStyleSheet(styleSheet); +} + void MainWindow::toggleSearchbar(bool visible) { config()->set(Config::showSearchbar, visible); diff --git a/src/MainWindow.h b/src/MainWindow.h index fc863e15..a4fc5903 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -215,6 +215,7 @@ private: void updateRecentlyOpenedMenu(); void updateWidgetIcons(); bool verifyPassword(); + void patchStylesheetMac(); QIcon hardwareDevicePairedIcon(); QIcon hardwareDeviceUnpairedIcon(); diff --git a/src/assets.qrc b/src/assets.qrc index bf99e011..cf9e9abf 100644 --- a/src/assets.qrc +++ b/src/assets.qrc @@ -3,6 +3,7 @@ assets/about.txt assets/ack.txt assets/feather.desktop + assets/macStylesheet.patch assets/nodes.json assets/gpg_keys/featherwallet.asc assets/images/appicons/32x32.png diff --git a/src/assets/macStylesheet.patch b/src/assets/macStylesheet.patch new file mode 100644 index 00000000..955debd9 --- /dev/null +++ b/src/assets/macStylesheet.patch @@ -0,0 +1,31 @@ +/* From electrum/gui/qt/stylesheet_patcher.py */ +StatusBarButton { + background-color: transparent; + border: 1px solid transparent; + border-radius: 4px; + margin: 0px; + padding: 2px; +} + +StatusBarButton:checked { + background-color: transparent; + border: 1px solid #1464A0; +} + +StatusBarButton:checked:disabled { + border: 1px solid #14506E; +} + +StatusBarButton:pressed { + margin: 1px; + background-color: transparent; + border: 1px solid #1464A0; +} + +StatusBarButton:disabled { + border: none; +} + +StatusBarButton:hover { + border: 1px solid #148CD2; +} \ No newline at end of file