Skip to content
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

Make all Qt ToolTips look similar to BalloonTips #9678

Merged
merged 1 commit into from May 17, 2021

Conversation

Filoppi
Copy link
Contributor

@Filoppi Filoppi commented Apr 28, 2021

Dolphin still has a lot of tooltips which haven't been converted to BalloonTips, which is fine, and some are way harder to convert as there is no code for them yet (e.g. ComboBox per item ToolTips).

With this simple addition to the qApp style sheet (mostly using existing code), ToolTips, and only ToolTips, will visualize themselves with the exact same colors and padding size of BalloonTips. Plus, now parts of their code is shared, so it can safely be changed in one place to reflect to both.

Tested. Works with high and not high contrast, or any theme brightness. Also works on top of any other style sheet (the ToolTip style is only overridden if not already specified).
There should be no possible regression from this, and BalloonTips will still look exactly as before (and they will not follow the user custom style sheet, just like before, which I think is a bit weird but it's fine).

This also fixes a bug (?) with Qt 5.15.0 on Windows 10 where calling SetCurrentUserStyle(...) before the MainWindow has been created, with a style sheet string different from null/emtpy (even an empty space is enough), causes some widgets to appear with a different style (e.g. the log widget background changes from black to white).

Notes:
-Making parts of the text (emphasis) take another color is not possible on default ToolTips of course
-I've tried to round the borders of default ToolTips but the background is drawn in a squared fashion behind the borders.

High contrast standard Qt ToolTip:
image

High contrast Dolphin BalloonTip:
image

.arg(window_color.rgba(), 0, 16)
.arg(text_color.rgba(), 0, 16)
.arg(border_color.rgba(), 0, 16);
stylesheet_contents.append(QStringLiteral("%1").arg(tooltip_stylesheet));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Appending a space here is not needed, if someone was wondering.

@@ -54,6 +54,10 @@ class Settings final : public QObject
void SetUserStylesEnabled(bool enabled);
bool AreUserStylesEnabled() const;

void GetToolTipStyle(QColor& window_color, QColor& text_color, QColor& emphasis_text_color,
Copy link
Contributor Author

@Filoppi Filoppi Apr 28, 2021

Choose a reason for hiding this comment

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

This could have been static for now but in the future it might depend on other settings.

Copy link
Contributor Author

@Filoppi Filoppi left a comment

Choose a reason for hiding this comment

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

Notes

@MayImilae
Copy link
Contributor

I'd like for all tooltips to move to the modern balloon tooltips eventually, but this seems like a good temporary solution to make the two tooltip types coexist a bit better.

@JMC47
Copy link
Contributor

JMC47 commented May 17, 2021

Seems like people are generally in favor of this. Has been reviewed and May says it's an improvement. Tested myself in the default GUI style and it worked fine.

@JMC47 JMC47 merged commit 678e035 into dolphin-emu:master May 17, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants