QToolbar force shrink
Qt toolbars shrink and display an 'extend' button when there isn't enough space.
开发者_运维百科Is there anyway to create a toolbar pre-shrunk? I want to display just the first label so I can use a large number of toolbars as floatable popup-menus (or a linear dialogboxs ).
I specifically want to use toolbars (rather than dialogs) because they are already created for another app.
Internally a class called QToolbarLayout
makes this decision about the "extension" button, based on the size of the space the toolbar is given:
http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/widgets/qtoolbarlayout.cpp#line398
So there's no method or slot for it, beyond setting its size. However, you could make your application persist the toolbar information between sessions via QSettings:
http://doc.qt.nokia.com/latest/qsettings.html#details
http://doc.qt.nokia.com/latest/qsettings.html#restoring-the-state-of-a-gui-application
That would allow your users who wished to work in this style the option of setting it up like that, and let those who didn't like it save their preferred layout as well.
精彩评论