tags:

views:

34

answers:

1

Hello,

I am creating a drawing application where the user can insert primitive shapes, like circles, triangles, etc. In the toolbar, I would like to have a single "Add Shape" button that shows a dropdown widget when pressed. In the dropdown, I would like to have a grid of QAction icons representing the different shapes the user can add. This is almost identical to how one adds basic shapes in powerpoint.

I know how to create a dropdown menu using a QToolButton and setMenu. However, this lists actions in a traditional menu format. I want the QActions showing only their icons, and to have them arranged in a grid - like a toolbar that has multiple rows. Do I have to create a custom widget for this?

Thanks!

A: 

Hello Eric,

By default QMenu uses a vertical layout to display the QActions so If you want a grid you need to subclass it to create your custom one.

cnebrera