macOS: fix statusbar button clickability

This commit is contained in:
tobtoht 2021-10-28 19:50:18 +02:00
parent 17519ef7c0
commit d68496bdd4
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
4 changed files with 49 additions and 0 deletions

View file

@ -95,6 +95,10 @@ void MainWindow::initStatusBar() {
this->statusBar()->setStyleSheet("QStatusBar::item {border: None;}"); this->statusBar()->setStyleSheet("QStatusBar::item {border: None;}");
#endif #endif
#if defined(Q_OS_MACOS)
this->patchStylesheetMac();
#endif
this->statusBar()->setFixedHeight(30); this->statusBar()->setFixedHeight(30);
m_statusLabelStatus = new QLabel("Idle", this); m_statusLabelStatus = new QLabel("Idle", this);
@ -849,6 +853,10 @@ void MainWindow::skinChanged(const QString &skinName) {
m_windowManager->changeSkin(skinName); m_windowManager->changeSkin(skinName);
ColorScheme::updateFromWidget(this); ColorScheme::updateFromWidget(this);
this->updateWidgetIcons(); this->updateWidgetIcons();
#if defined(Q_OS_MACOS)
this->patchStylesheetMac();
#endif
} }
void MainWindow::updateWidgetIcons() { void MainWindow::updateWidgetIcons() {
@ -1586,6 +1594,14 @@ bool MainWindow::verifyPassword() {
return true; 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) { void MainWindow::toggleSearchbar(bool visible) {
config()->set(Config::showSearchbar, visible); config()->set(Config::showSearchbar, visible);

View file

@ -215,6 +215,7 @@ private:
void updateRecentlyOpenedMenu(); void updateRecentlyOpenedMenu();
void updateWidgetIcons(); void updateWidgetIcons();
bool verifyPassword(); bool verifyPassword();
void patchStylesheetMac();
QIcon hardwareDevicePairedIcon(); QIcon hardwareDevicePairedIcon();
QIcon hardwareDeviceUnpairedIcon(); QIcon hardwareDeviceUnpairedIcon();

View file

@ -3,6 +3,7 @@
<file>assets/about.txt</file> <file>assets/about.txt</file>
<file>assets/ack.txt</file> <file>assets/ack.txt</file>
<file>assets/feather.desktop</file> <file>assets/feather.desktop</file>
<file>assets/macStylesheet.patch</file>
<file>assets/nodes.json</file> <file>assets/nodes.json</file>
<file>assets/gpg_keys/featherwallet.asc</file> <file>assets/gpg_keys/featherwallet.asc</file>
<file>assets/images/appicons/32x32.png</file> <file>assets/images/appicons/32x32.png</file>

View file

@ -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;
}