-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
Added ability to properly remove icons from menus (for a cleaner UX) #3230
Conversation
There already is a rule for macOS 🤔: Lines 152 to 155 in 0d11bd1
We need to do something about that too... |
I don't have a way to test things on a Mac, but would it be OK to limit the patch to Linux and Windows via #ifdef and such? The existing Mac logic can stay the way it is. Or it can be removed (but unfortunately I wouldn't be able to test the result on a Mac.) So my suggestion would be to limit the patch to Windows and Linux only. Your thoughts? |
First one other question: Why was Seems to work fine under Linux. The command bar is extra of course. I guess it would be best to stick to Lines 1299 to 1301 in a1c7a31
|
No, not enough, that's the whole point. The Not only do the empty spaces look bad, they also make the menus with hidden icons look different from other menus that are icon-less by design, for example, the Toolbars menu. This inconsistency IMO would make the UI look less professional than it could be :) |
ok, then still ☝🏻 and the builds are still failing, because of the duplicate declaration (how did the build work for you? 🤔) |
You're right. The build worked for me because the patch I provided depends on another patch (not included here for now). Fixed it here. It now compiles on my end when I do a clean |
@pbek Some builds failed due to undefined reference to `vtable for NoMenuIconStyle', which is fixed now. |
Please use lower case characters for |
src/utils/misc.cpp
Outdated
* @return | ||
*/ | ||
bool Utils::Misc::hideIconsInMenus() { | ||
return SettingsService().value(QStringLiteral("hideIconsInMenus"), true).toBool(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default needs to be true for macOS and false for all other operating systems. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm now setting the default here: 259c49f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could instead of setting true
just use a variable that is set to false and set it to true with a compiler directive for macOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I don't quite follow... Do you mean we shouldn't use if (!settings.contains(QStringLiteral("hideIconsInMenus"))) { ... }
? if so, why?
I'm new to Qt and the code-base, so if you think there's a better way to do the macOS check, please feel free to give it a quick edit :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #3230 (comment)
src/main.cpp
Outdated
} | ||
|
||
#ifdef Q_OS_MAC | ||
QApplication::setStyle(new NoMenuIconStyle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than forcing the style for macOS, please use your new setting instead and set a proper default value in your hideIconsInMenus
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, no forcing, but can we just set a default like I did here? 259c49f
I've tested it under Linux with #ifdef Q_OS_LINUX
instead of #ifdef Q_OS_MAC
and it seems to work fine.
When no setting has been defined, the app hides icons on macOS. If a user ticks the checkbox, the app reads that setting instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was talking about a variable for the default value, like here:
QOwnNotes/src/dialogs/settingsdialog.cpp
Lines 1058 to 1066 in c6c3589
#ifdef Q_OS_MAC | |
bool restoreCursorPositionDefault = false; | |
#else | |
bool restoreCursorPositionDefault = true; | |
#endif | |
ui->restoreCursorPositionCheckBox->setChecked( | |
settings.value(QStringLiteral("restoreCursorPosition"), restoreCursorPositionDefault) | |
.toBool()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, how about this? 7f7cc8c
Renamed and moved the files, but the
Running the script produces a bunch of "not found" errors... |
omg, I'm, at clang-format version 19.1.5 |
Can you please run the script then? |
src/utils/misc.cpp
Outdated
|
||
SettingsService settings; | ||
|
||
if (!settings.contains(QStringLiteral("hideIconsInMenus"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need that whole if-clause, because there is no old setting to migrate from.
Oh, there is something important that slipped my review: Lines 192 to 201 in da690c2
You are breaking the interface style setting with your QApplication::setStyle! |
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
I'll disable your But I still can't see a difference between the two in the menu. 🤔 Could you maybe provide screenshots where you see a difference on your system? |
…erfaceStyle settting Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
This is very frustrating, I'm sorry to say :) Because now it looks broken...
Sure. The first screenshot uses The second screenshot uses the PR that actually deals with the problem: |
Maybe you can find a solution, that will still keep the interfaceStyle setting. |
It's interesting that Would you accept a patch that relies on |
That would be an option, but you need to keep in mind that the interfaceStyle setting is applied dynamically while the setting dialog is opened and when the selectbox in the dialog changes! The better solution would be if your style could somehow inherit the interfaceStyle, maybe like in the example from https://doc.qt.io/qt-6/qapplication.html#setStyle.
I guess macOS can use the same handling as above... |
Thanks for the pointer. Right now time does not permit me to work on any more patches, but maybe in the future. Good luck! |
Thank you, and thank you for your contribution! |
25.2.4
There now is a new release, could you please test it and report if it works for you? |
…erfaceStyle setting Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
Can you please also test the latest main branch with 854a3ab, where I tried to make interfaceStyle work with NoMenuIconStyle? Can you please test different interfaceStyle settings with hideIconsInMenus set to true and false? |
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
The 854a3ab commit works fine, I tested with the "Automatic" setting for style (which happens to be Kvantum on my box), as well as "motif", "windows" and "plastique" styles. Awesome! I've tried with "hideIconsInMenus" on and off. There's one hiccup: with "hideIconsInMenus" on, if a user changes the interface style, the style is applied, but the menu icons reappear until the app is restarted. Seems like prompting for a restart after changing the interface style would make everything work perfectly. Will be happy to test. P. S. Incidentally, I now remember playing with interface styles when I first installed QOwnNotes, and I think the styles did not always perfectly applied unless I restarted the app. Seems like it's a good idea to prompt for a restart when changing a style anyway. |
Hah, didn't catch my eyes. Thank you for mentioning. Forgot a stray
|
Yes. Everything works as expected, except the hiccup I mentioned above. |
Ok, great. I'll fix the hiccup in the evening. |
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
25.2.5
There now is a new release, could you please test it and report if it works for you? |
@pbek Works nicely now, thank you! |
Great, thank you for testing! |
Hi, and thank you for creating QOwnNotes. I've been using it for a couple of weeks now (migrated from a legacy note-taking app) and it looks very impressive so far! Packed with features, very customizable and scriptable.
I'm using it on a mostly GTK-based Linux desktop where menus do not have icons and would like to have the same option in QOwnNotes for a cleaner user experience.
I'm very new to Qt and it took some research to properly remove the icons.
First, I've tried to do it the way macOSX icons are removed in the QOwnNotes code-base (
Qt::AA_DontShowIconsInMenus
), but this method leaves empty spaces in place of the icons (at least on Linux), which doesn't look good at all, IMO.Another option is to simply iterate over all the actions and set icons to null. This removes the icons and the empty space, but kill icons in toolbars too.
After experimenting, I've found that the best way is to use QProxyStyle. Hence this patch.
I'm not interested in maintaining my own fork :), so would appreciate it if you could merge it on your end. I've noticed some other little bugs/quirks here and there. I'll try to report them soon as time permits.
Overall, QOwnNotes looks like a great app with a ton of useful features. So thank you again for creating it and let me know if the patch can be merged.