开发者

QToolbar force shrink

开发者 https://www.devze.com 2023-04-10 17:48 出处:网络
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

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 ).

QToolbar force shrink

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号