Arrows in transferlistfilterswidget too huge on macOS #8738

Closed
opened 2026-02-21 19:47:03 -05:00 by deekerman · 7 comments
Owner

Originally created by @Kolcha on GitHub (May 26, 2019).

qBittorrent version and Operating System

qBittorrent 4.2.0alpha , master branch, commit c5430030e3
macOS Mojave 10.14.5

If on linux, libtorrent and Qt version

libtorrent 1.2.1 , built from RC_1_2 branch
Qt 5.14.0 , built from dev branch

What is the problem

Arrows appeared in https://github.com/qbittorrent/qBittorrent/pull/10684 looks too huge on Retina display on macOS
Screenshot 2019-05-26 22 08 31

What is the expected behavior

Arrows looks like there https://github.com/qbittorrent/qBittorrent/pull/10684#issue-281169676

Steps to reproduce

build qBittorrent from master branch and run on macOS system with Retina display

Extra info(if any)

it is very possible that I can fix it myself and post pull request, if developers don't have suitable dev/test environment. I have enough knowledge and suitable environment to do that.

Originally created by @Kolcha on GitHub (May 26, 2019). ### qBittorrent version and Operating System qBittorrent 4.2.0alpha , master branch, commit c5430030e30d70f3b7e2b8f6160643f40c8ab6e8 macOS Mojave 10.14.5 ### If on linux, libtorrent and Qt version libtorrent 1.2.1 , built from *RC_1_2* branch Qt 5.14.0 , built from *dev* branch ### What is the problem Arrows appeared in https://github.com/qbittorrent/qBittorrent/pull/10684 looks too huge on Retina display on macOS <img width="201" alt="Screenshot 2019-05-26 22 08 31" src="https://user-images.githubusercontent.com/947647/58386084-65a3c680-8003-11e9-89bc-28bfe42c4915.png"> ### What is the expected behavior Arrows looks like there https://github.com/qbittorrent/qBittorrent/pull/10684#issue-281169676 ### Steps to reproduce build qBittorrent from master branch and run on macOS system with Retina display ### Extra info(if any) it is very possible that I can fix it myself and post pull request, if developers don't have suitable dev/test environment. I have enough knowledge and suitable environment to do that.
Author
Owner

@Chocobo1 commented on GitHub (May 26, 2019):

In my environment, the arrow looks small on Linux (cinnamon DE) but just right on Windows... this could be complicated.

@Chocobo1 commented on GitHub (May 26, 2019): In my environment, the arrow looks small on Linux (cinnamon DE) but just right on Windows... this could be complicated.
Author
Owner

@Chocobo1 commented on GitHub (May 26, 2019):

Offtopic, btw you might be interested that there are some deprecated warnings I wished to get rid of but lack of equipment & knowledge:
https://travis-ci.org/qbittorrent/qBittorrent/jobs/537524506#L1012-L1048
just FYI

@Chocobo1 commented on GitHub (May 26, 2019): Offtopic, btw you might be interested that there are some deprecated warnings I wished to get rid of but lack of equipment & knowledge: https://travis-ci.org/qbittorrent/qBittorrent/jobs/537524506#L1012-L1048 just FYI
Author
Owner

@Kolcha commented on GitHub (May 27, 2019):

so... I made some investigations. Just created small test app with your custom control to debug it easily. There are some results below.
First of all, this is not your (qBittorrent dev team) issue, this is Qt issue. The "root of this evil" inside Qt's mac style implementation. It just draws that arrows in this way.
As solution I can suggest draw this arrows in Fusion style on macOS, in this case they will look very similar to Windows (I checked how it looks on Windows and it's fine).

there are 2 screenshots below demonstrating how this control looks in Fusion style but drawn in slightly different ways: on the first one indicatorOption.rect was got from Fusion style, on the second - from mac style. red frame shows the area for the arrow (indicatorOption.rect).

Screenshot 2019-05-28 01 09 37 Screenshot 2019-05-28 01 09 57

I think the second option looks better comparing to unmodified checkboxes.
If devs agree with such solution I'll send pull request with this small change.

@Kolcha commented on GitHub (May 27, 2019): so... I made some investigations. Just created small test app with your custom control to debug it easily. There are some results below. First of all, this is not your (qBittorrent dev team) issue, this is Qt issue. The "root of this evil" inside [Qt's mac style implementation](https://github.com/qt/qtbase/blob/534df5a33bd6a3d0d00194212cf868a9ef57bd53/src/plugins/styles/mac/qmacstyle_mac.mm#L3022-L3024). It just draws that arrows in this way. As solution I can suggest draw this arrows in Fusion style on macOS, in this case they will look very similar to Windows (I checked how it looks on Windows and it's fine). there are 2 screenshots below demonstrating how this control looks in Fusion style but drawn in slightly different ways: on the first one `indicatorOption.rect` was got from **Fusion** style, on the second - from **mac** style. red frame shows the area for the arrow (`indicatorOption.rect`). <img width="1280" alt="Screenshot 2019-05-28 01 09 37" src="https://user-images.githubusercontent.com/947647/58441091-c3114380-80e7-11e9-8cb5-d4aaeb8b8a03.png"> <img width="1280" alt="Screenshot 2019-05-28 01 09 57" src="https://user-images.githubusercontent.com/947647/58441153-37e47d80-80e8-11e9-9ff3-94dfd838c9c7.png"> I think the second option looks better comparing to unmodified checkboxes. If devs agree with such solution I'll send pull request with this small change.
Author
Owner

@Kolcha commented on GitHub (May 27, 2019):

Offtopic, btw you might be interested that there are some deprecated warnings I wished to get rid of but lack of equipment & knowledge:
https://travis-ci.org/qbittorrent/qBittorrent/jobs/537524506#L1012-L1048
just FYI

@Chocobo1 I will look into it. But not guarantee that I fix it, I'm not "Pro macOS developer", I'm experienced c++ developer which have mac hardware and don't afraid to dig deep in huge libraries like Qt :)

@Kolcha commented on GitHub (May 27, 2019): > Offtopic, btw you might be interested that there are some deprecated warnings I wished to get rid of but lack of equipment & knowledge: > https://travis-ci.org/qbittorrent/qBittorrent/jobs/537524506#L1012-L1048 > just FYI @Chocobo1 I will look into it. But not guarantee that I fix it, I'm not "Pro macOS developer", I'm experienced c++ developer which have mac hardware and don't afraid to dig deep in huge libraries like Qt :)
Author
Owner

@Chocobo1 commented on GitHub (May 27, 2019):

@Kolcha
Thanks for pointing the Qt source! I finally get the below code to work. It should be more ideal than the current way.

        void paintEvent(QPaintEvent *) override
        {
            QPainter painter(this);

            QStyleOptionViewItem indicatorOption;
            indicatorOption.initFrom(this);
            indicatorOption.rect = style()->subElementRect(QStyle::SE_CheckBoxIndicator, &indicatorOption, this);
            indicatorOption.state |= (QStyle::State_Children
                                      | (isChecked() ? QStyle::State_Open : QStyle::State_None));
            style()->drawPrimitive(QStyle::PE_IndicatorBranch, &indicatorOption, &painter, this);

            QStyleOptionButton labelOption;
            initStyleOption(&labelOption);
            labelOption.rect = style()->subElementRect(QStyle::SE_CheckBoxContents, &labelOption, this);
            style()->drawControl(QStyle::CE_CheckBoxLabel, &labelOption, &painter, this);
        }

Could you please test it on macOS?

If devs agree with such solution I'll send pull request with this small change.

If the above code is still bad, I think you can submit a PR and we can all test it :)

Also loop @jagannatharjun in.

@Chocobo1 commented on GitHub (May 27, 2019): @Kolcha Thanks for pointing the Qt source! I finally get the below code to work. It should be more ideal than the current way. ```c++ void paintEvent(QPaintEvent *) override { QPainter painter(this); QStyleOptionViewItem indicatorOption; indicatorOption.initFrom(this); indicatorOption.rect = style()->subElementRect(QStyle::SE_CheckBoxIndicator, &indicatorOption, this); indicatorOption.state |= (QStyle::State_Children | (isChecked() ? QStyle::State_Open : QStyle::State_None)); style()->drawPrimitive(QStyle::PE_IndicatorBranch, &indicatorOption, &painter, this); QStyleOptionButton labelOption; initStyleOption(&labelOption); labelOption.rect = style()->subElementRect(QStyle::SE_CheckBoxContents, &labelOption, this); style()->drawControl(QStyle::CE_CheckBoxLabel, &labelOption, &painter, this); } ``` Could you please test it on macOS? >If devs agree with such solution I'll send pull request with this small change. If the above code is still bad, I think you can submit a PR and we can all test it :) Also loop @jagannatharjun in.
Author
Owner

@Kolcha commented on GitHub (May 28, 2019):

@Chocobo1 , your code works perfectly on macOS! 👍 it gives similar result to Fusion style, but arrow has gray color, what I think looks even better, rather than black one.
Screenshot 2019-05-28 10 07 12

@Kolcha commented on GitHub (May 28, 2019): @Chocobo1 , your code works perfectly on macOS! 👍 it gives similar result to Fusion style, but arrow has gray color, what I think looks even better, rather than black one. <img width="1280" alt="Screenshot 2019-05-28 10 07 12" src="https://user-images.githubusercontent.com/947647/58457952-97ff1200-8130-11e9-824a-a39ec8158c50.png">
Author
Owner

@Chocobo1 commented on GitHub (May 28, 2019):

I've submitted PR #10720.

@Chocobo1 commented on GitHub (May 28, 2019): I've submitted PR #10720.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#8738
No description provided.