How to set buttons in QMenuBar in the right corner in Qt5?

I need to add two buttons on the right side of QMenuBar (in the left normal menu items) and change the icons from time to time. Is it possible?

+4
source share
2 answers

I need to add two buttons on the right side of QMenuBar (in the left normal menu items)

This question may have an answer on how to add buttons to the right side of the menu bar: Laying QPushButtons on the other side of the QMenuBar .

and change the icons from time to time

You can use QTimer to run the slot periodically. Inside the slot, use QPushBtton :: setIcon () to change the icon.

+2
source

You can use the "layout direction":

QMainWindow mainW; mainW.show(); QMenuBar* menu = new QMenuBar(); menu->addAction( "action 1" ); menu->addAction( "action 2" ); mainW.setMenuBar( menu ); menu->setLayoutDirection( Qt::RightToLeft); // Display menu bar to the right 
+1
source

All Articles