E
E
Egorithm2020-08-03 21:57:36
Qt
Egorithm, 2020-08-03 21:57:36

How to make QAction and QMenu inside QMenuBar maximum height?

There is no way to make the content QMenuBarfull height:
5f285e07e3d24084386177.png
The height is QMenuBarcalculated from the height of the screen. By measurement, I found that it is equal to 29 pixels. At the same time, if I put 29px through setStyleSheet(), then everything just disappears, but at 24px they occupy exactly the QActionentire . But this is no good, such numbers are individual for each car. You need to somehow stretch to the full height. I've tried everything I could, but it doesn't work. I will be grateful for help.QMenuQMenuBar

menubar->setStyleSheet("QMenuBar:maximized { min-height: 15px; max-height: 25px; }"
                        //"QMenuBar { height: 20px; }"
                        //"QMenuBar::item { height: 25px; }"
                        //"QAction { height: 25px; }"
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egorithm, 2020-08-04
@EgoRusMarch

In general, the best option I found is to use QToolBarwith QToolButton, and where you need a menu, use the QToolButton::setMenu(). It looks good and, most importantly, QToolButtonis the heir QWidget, unlike QAction.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question