0

I have a QMenubar inside QMainWindow. I have set it to be displayed on the right corner using setCornerWidget. But the menu items are going out of the main window. How can I prevent the menu to be displayed within the window?

enter image description here

I have already tried menu->setLayoutDirection(Qt::RightToLeft) which is giving me a mirror image of the current menu display as seen below, but that does not look good to me. Is there a way to keep the direction from Qt::LeftToRight and still be able to contain the menu inside the window?

enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • You could show a picture of what you want to get. I will also propose an extreme case: Let's say that the width of the menu is larger than that of the window. What should happen in that case? – eyllanesc Dec 24 '19 at 18:01
  • Have never met such possibility in Qt. Why do you need it? Actually you can manage the menu position and size by your code, but it may be a complicated thing. – ilotXXI Dec 24 '19 at 19:37
  • Did you try using style sheets? using move or mapToGlobal? https://doc.qt.io/qt-5/qwidget.html#mapToGlobal – Ahed Kabalan Dec 25 '19 at 22:21

0 Answers0