reducing the width of QMenuBar and QToolBar in mainWindow

♀尐吖头ヾ 提交于 2019-12-11 15:00:01

问题


In my MainWindow ,menuBar contents and toolBar contents are few that it will occupy only a small portion in the left side off the main window and the rest of the portion is left empty. Im having a info frame with some widgets in it in the right side of the centerwidget.

my question is that can i use the the info frame from the menu bar space itself as menubar and toolbar can occupy only left portion of the mainwindow and i can use the entire right portion for info frame..?


回答1:


You can't use that space through layout because this space is already taken by the main menu and the toolbar. There is no option to put something in this space.

But you can add a main window's child without putting it in any layout. It will be shown above all layed out children. But you will have to calculate and adjust size and position of this widget manually.

For example, add the following code to the main window's constructor:

QPushButton* b = new QPushButton("TEST", this);
b->move(200, 0);

It looks like this:



来源:https://stackoverflow.com/questions/17336563/reducing-the-width-of-qmenubar-and-qtoolbar-in-mainwindow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!