Skip to content

Use "fusion" style on macOS Big Sur with old Qt #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jan 7, 2021

@hebasto
Copy link
Member Author

hebasto commented Jan 7, 2021

@jonasschnelli @laanwj @MarcoFalke

As the upcoming 0.21 release is the first one after macOS Big Sur release, do you mind considering to backport this change into the 0.21 branch in order to ship the usable binaries to Big Sur users?

@prusnak
Copy link
Contributor

prusnak commented Jan 7, 2021

Why is there the version check for Qt? I see the same issue with Qt 5.12 on Big Sur.

Also checking for "macOS 11" is spurious.

Do we need the version checks at all? Why don't just apply this always on macOS?

@hebasto
Copy link
Member Author

hebasto commented Jan 7, 2021

Why is there the version check for Qt?

This change, actually, is intended to fix visual quality for builds with depends, including shipped releases.

I see the same issue with Qt 5.12 on Big Sur.

With the latest Homebrew's Qt 5.15.2 the native macOS style looks much better.

Also checking for "macOS 11" is spurious.

Not sure if I understand you correctly. Do you mind elaborating your comment?

Do we need the version checks at all? Why don't just apply this always on macOS?

Many (most?) macOS users prefer the native macOS style, and the "fusion" does not look native on macOS.

@maflcko maflcko added this to the 0.21.1 milestone Jan 8, 2021
Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

I applied this patch to the rc5 source code to see how it would react on macOS Big Sur 11.1 with bitcoin-qt built with Qt 5.9.8.

The name check does not work:
if (QSysInfo::prettyProductName().startsWith("macOS 11"))
Removing this check successfully allows the Qt Fusion Style to appear. I'll investigate what's wrong with the naming.

Branch: 9f50395
Qt Fusion Style fails to appear
Screen Shot 2021-01-08 at 4 39 44 AM

Removing The Conditional
Fusion Style appears
Screen Shot 2021-01-08 at 8 53 06 AM

The "macintosh" style is broken on macOS Big Sur at least for Qt 5.9.8.
@hebasto
Copy link
Member Author

hebasto commented Jan 8, 2021

Updated 9f50395 -> 4e1154d (pr177.01 -> pr177.02, diff):

The name check does not work:
if (QSysInfo::prettyProductName().startsWith("macOS 11"))

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 4e1154d

Qt Fusion successfully shows. Tested with patched rc5 source code on macOS Big Sur with Qt 5.9.8

@jonasschnelli
Copy link
Contributor

This PR macOS 11 dark mode (self compiled against Qt 5.14):
Bildschirmfoto 2021-01-11 um 14 38 09
Bildschirmfoto 2021-01-11 um 14 38 12
Bildschirmfoto 2021-01-11 um 14 39 32
Bildschirmfoto 2021-01-11 um 14 38 18
Bildschirmfoto 2021-01-11 um 14 38 28

Master Dark Mode macOS 11:
Bildschirmfoto 2021-01-11 um 14 39 27
Bildschirmfoto 2021-01-11 um 14 39 32
Bildschirmfoto 2021-01-11 um 14 39 38

I can't see any major visual differences.
Master already looks good on macOS BigSure. Is that due to Qt 5.14?

@hebasto
Copy link
Member Author

hebasto commented Jan 11, 2021

@jonasschnelli

Is that due to Qt 5.14?

Yes:

gui/src/qt/bitcoin.cpp

Lines 470 to 475 in 4e1154d

#if (QT_VERSION <= QT_VERSION_CHECK(5, 9, 8)) && defined(Q_OS_MACOS)
const auto os_name = QSysInfo::prettyProductName();
if (os_name.startsWith("macOS 11") || os_name.startsWith("macOS 10.16")) {
QApplication::setStyle("fusion");
}
#endif

With Qt 5.14 the "macintosh" style looks not ideal, but usable.
With Qt 5.9.8, that is shipped to users as gitian builds, it is unusable at all.

@@ -466,6 +467,13 @@ int GuiMain(int argc, char* argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

#if (QT_VERSION <= QT_VERSION_CHECK(5, 9, 8)) && defined(Q_OS_MACOS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the linked Qt bug, this version check appears wrong?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version check is correct because #136 concerns Qt compiled on macOS with depends. Compiling with depends builds bitcoin-qt with Qt 5.9.8. See: Qt Depends Package

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the linked Qt bug, this version check appears wrong?

The link to Qt bug removed from the OP. It is possible that version check could be improved, but I do not know for sure from which Qt version widgets are quite usable (I do not even say about fixing all bugs).

The recent Homebrew's Qt versions look decent (but not ideal). And this PR goal is to fix GUI look while building with depends (including gitian binary).

@@ -466,6 +467,13 @@ int GuiMain(int argc, char* argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

#if (QT_VERSION <= QT_VERSION_CHECK(5, 9, 8)) && defined(Q_OS_MACOS)
const auto os_name = QSysInfo::prettyProductName();
if (os_name.startsWith("macOS 11") || os_name.startsWith("macOS 10.16")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it should apply to 12+ as well, though probably the issue will be long-gone by then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is. This is meant to be a patch until the Qt version is bumped up from 5.9.8, not a permanent fix. Presumably, we will get the Qt version bumped up before there is a macOS 12.

Copy link
Member Author

@hebasto hebasto Jan 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it should apply to 12+ as well, though probably the issue will be long-gone by then

Did not test 10.12, but there are no such visual issues on Catalina 10.15.7 (19H114) with the recent 0.21.0 release.

I believe the "macintosh" style is broken on macOS Big Sur only.

UPDATE: v0.21.0 looks on Mojave 10.14 fine.

@hebasto
Copy link
Member Author

hebasto commented Jan 21, 2021

Btw, there is an alternative to this PR. It is reverting of bitcoin/bitcoin#16578. Then it would be possible to pass -style Fusion as a command line argument.

cc @achow101

@achow101
Copy link
Member

Btw, there is an alternative to this PR. It is reverting of bitcoin/bitcoin#16578

NACK. The details will become clear soon.

@luke-jr
Copy link
Member

luke-jr commented Jan 21, 2021

Btw, there is an alternative to this PR. It is reverting of bitcoin/bitcoin#16578. Then it would be possible to pass -style Fusion as a command line argument.

Users should not need to pass options.

@maflcko maflcko added the macOS label Jan 21, 2021
@maflcko
Copy link
Contributor

maflcko commented Jan 21, 2021

run appveyor (will need to be rerun before merge)

@maflcko
Copy link
Contributor

maflcko commented Jan 25, 2021

review ACK 4e1154d can't test

@laanwj
Copy link
Member

laanwj commented Jan 26, 2021

So nice to see we're finally going to support MacOS dark mode.
(Concept ACK, can't test this)

Copy link
Contributor

@jonasschnelli jonasschnelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK 4e1154d

@jonasschnelli jonasschnelli merged commit 02b0165 into bitcoin-core:master Jan 28, 2021
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jan 28, 2021
The "macintosh" style is broken on macOS Big Sur at least for Qt 5.9.8.

Github-Pull: #bitcoin-core/gui#177
Rebased-From: 4e1154d
@maflcko
Copy link
Contributor

maflcko commented Jan 28, 2021

Backported in bitcoin/bitcoin#20901

@hebasto hebasto deleted the 210107-style branch January 28, 2021 09:46
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 28, 2021
maflcko pushed a commit that referenced this pull request Mar 16, 2021
77833a3 Revert "qt: Use "fusion" style on macOS Big Sur with old Qt" (Hennadii Stepanov)

Pull request description:

  This PR reverts workaround introduced in #177.

  After bumping Qt version in depends to 5.12.10 in bitcoin/bitcoin#21376, there are no reasons to use the Fusion style on macOS.

ACKs for top commit:
  leonardojobim:
    tACK 77833a3. Tested on macOS Big Sur v11.2.3
  jarolrod:
    ACK 77833a3
  Talkless:
    utACK 77833a3

Tree-SHA512: f704f2027dd380dfc604231e3606a036a8be891aeeddf643c474131014fa080e123b42836ac643a2064fe7a5a018fa8b9aa61a31f9da1d15880de6a36c4c0d54
apoelstra pushed a commit to apoelstra/elements that referenced this pull request Sep 21, 2021
The "macintosh" style is broken on macOS Big Sur at least for Qt 5.9.8.

Github-Pull: #bitcoin-core/gui#177
Rebased-From: 4e1154d
(cherry picked from commit 6dc58e9)
apoelstra pushed a commit to apoelstra/elements that referenced this pull request Sep 21, 2021
The "macintosh" style is broken on macOS Big Sur at least for Qt 5.9.8.

Github-Pull: #bitcoin-core/gui#177
Rebased-From: 4e1154d
(cherry picked from commit 6dc58e9)
apoelstra pushed a commit to apoelstra/elements that referenced this pull request Sep 22, 2021
The "macintosh" style is broken on macOS Big Sur at least for Qt 5.9.8.

Github-Pull: #bitcoin-core/gui#177
Rebased-From: 4e1154d
(cherry picked from commit 6dc58e9)
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants