tru7
tru7

Reputation: 7222

Setting height of QMenu items

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.

Upvotes: 2

Views: 5874

Answers (1)

Iuliu
Iuliu

Reputation: 4091

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.

Upvotes: 8

Related Questions