views:

44

answers:

1

Hello, I'm trying to design a UI in Qt and I can't find anywhere in the designer a button which can be "droped down" like combobox. What I mean by that is that I would like to have this button with his "default" option choosen so if I like it I would have to just click on it but if I would like to choose different option I would be able to clik the little arrow on the right side of this button and then pick option suitable for me at that moment.

+2  A: 

You're looking for a QToolButton that has a set of actions or a menu set on it. From the documentation, the QToolButton::ToolButtonPopupMode...

Describes how a menu should be popped up for tool buttons that has a menu set or contains a list of actions.

Of it's values, the two that I see most frequently are DelayedPopup:

After pressing and holding the tool button down for a certain amount of time (the timeout is style dependant, see QStyle::SH_ToolButton_PopupDelay), the menu is displayed. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list

And MenuButtonPopup:

In this mode the tool button displays a special arrow to indicate that a menu is present. The menu is displayed when the arrow part of the button is pressed.

Kaleb Pederson
@Kaleb that's the one.