Setting height of QMenu items

5.5k views Asked by At

Is it possible to style a QMenu:item to set a custom height?

I need it for a popup menu, by what I've been seeing it seems it's not possible but maybe someone knows for sure.

1

There are 1 answers

1
Iuliu On BEST ANSWER

Have you tried to use QSS? This works fine for me:

QMenu::item {
    height: 42px;
    margin: 0px;
}

You can use pMenu->setStyleSheet("QMenu::item { height: 42px; margin: 0px; }");.

Note: Make sure you use :: and not : to reference the item.