简体   繁体   中英

How to add a widget to a qt Tool bar

I have the following problem: I have added a spinner to my qt Tool Bar, which is located from top to buttom. This works fine. But now I want to order some buttons in a special order, but with mainToolBar->addWidget(button_name) it would be among one other. So how can I solve it? I tried to make a new widget "widget_1" and added some buttons to this widget, but when I write mainToolBar->addWidget(widget_1) nothing appears, only the one slider I have already added. Can anyone help me? Thanks a lot :)

Well, just forget something. select the widget and then layout in a form or whatever layouting you prefer. And that's it. now, the widget will be shown in toolbar. it's because of size and child widgets position. by layouting, everything will be resized and position correctly.

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