Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: Drop-down button?

Tags:

qt

qt-designer

How can I create a "drop down button" in Qt?

For a non-Qt example, see: Combination button/dropdown in office

The key point is that the widget needs an icon for the primary action, and a visually separate "pulldown arrow" to show secondary icons / actions.

Upon clicking the "pulldown arrow" for secondary options, the user should be presented with a grid of other icons to choose from. (All icons, no text.)

Does Qt have a widget that can do this?

If not, how can this be created in Qt? (I'm a new Qt user, so a Qt Designer based solution would be ideal.)

Thank you

like image 706
nonot1 Avatar asked Apr 17 '11 17:04

nonot1


People also ask

What is a drop down button?

A dropdown button lets the user select from a number of items. The button shows the currently selected item as well as an arrow that opens a menu for selecting another item.

How do you create a drop down list in Python?

Build A Paint Program With TKinter and Python First, we will instantiate an object of StringVar(), then we will set the initial value of the dropdown menu. We will create the dropdown menu by creating an object of OptionMenu and passing the value of window, menu object, and options which are to be displayed.


1 Answers

Actually, a QToolButton does this quite well.

http://qt-project.org/forums/viewthread/5377

It appears the OP asked this in a Qt forum and got a better answer. Adding it here for completeness.

like image 112
bb121622 Avatar answered Oct 15 '22 03:10

bb121622