July 17, 2009 by Jens Bache-Wiig | Comments
Both GNOME and KDE has a nice little control panel that allows you to configure how you want your toolbars to appear. Pure Qt applications show only the icons by default. Unfortunately, I don't think it is a good idea to suddenly change this behavior, but we can do the next best thing and allow you to opt-in. Starting with 4.6, you can use setToolButtonStyle(Qt::ToolButtonFollowStyle) on your mainwindow, tool bar or tool button to make your application dynamically follow desktop settings.
Here is a Qt app on GNOME with "Text below Items":
And this is how it looks with with "Text beside Items":
There are a few things you should do before you enable this setting though. First you should allways set QAction::IconText, otherwise your annoyingly long tool tip text will suddenly appear next to your icon. However, as you can barely see in the second screenshot, doing that is not enough to properly support Qt::TextBesideIcon since putting all that text into the toolbar generally takes up a bit too much space.
To solve this problem we added QAction::setPriority(QAction::Priority). In other words, you can now mark actions as more or less important. Quite handy for dynamic layouts determining which items to collapse first. In this case, actions with low priority will hide their label automatically when changing to this desktop setting.
Download the latest release here: www.qt.io/download.
Qt 6.9 is now available, with new features and improvements for application developers and device creators.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Apr 2, 2025
Qt 6.9 is now available, with new features and improvements for..
Feb 26, 2025
We are happy to announce the release of the Qt Tools for Android Studio..
Jan 27, 2025
A Qt Quick Controls style defines the visual representation of the..
Commenting for this post has ended.
Great job!
It will make things easier to integrate Qt applications into GNOME.
What about customizable toolbar? It would be nice to be able to drag and drop a QAction onto the toolbar. With the animation framework you could animate the move of the neighboring icons to show where the icon will be positioned.
Great !
It is a shame that this cannot be the default behaviour. Is there a list of these "quirks" kept somewhere that developers should be aware of?
@chaz6: Yeah, having a page dedicated to how you make applications truly integrate with the native platform is something I have been thinking about for a while. The information is somewhat scattered at the moment.
@Linux: There is already something available for this here: http://www.qtsoftware.com/p... but unfortunately it's not as fancy as the one you are suggesting.
I feel like I have to propose one more suggestion:
"Selective text next to icons", and when creating a UI for your icon toolbar, mark some text items as important ;)
Some icons might be self explanatory while others can be non-obvious, so this kind of feature will help people to preserve space and see text for icons which are not very straightforward.