简体   繁体   中英

Using main menu as toolbar in Qt

I'd like to create a toolbar that contains main menu, just like the standard main menu at the top of the window.

Is there some fast way to do this in QT ? I know that I can create a toolbar with buttons and context menus :-)

Thx for help.

You can add any widget to QToolBar using:

QMenuBar *mb = new QMenuBar();
QToolBar::addWidget(mb);

It might be easier to reparent designer's ui->menubar to toolbar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM