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.
Jun 13, 2025
There is a "Use After Free" vulnerability in Qt's QHttp2ProtocolHandler in..
Jun 11, 2025
When loading a specifically crafted ICNS format image file then it will..
Jun 6, 2025
An issue was found in the private API function qDecodeDataUrl() in QtCore,..