开发者

How to force QMenuBar to have the same background color as QToolBar

My menu bar is placed inside my toolbar :) And I wan't both of them to have the same background color. In some color themes menubar background is different then in toolbars (lighter). How do I sync them and at the same time maintain current theme colors.

Can I force QMenuBar not to draw background ?

I tri开发者_如何学Goed to use stylesheets with background-color:.. but submenus in menu bar lose borders and there is now hover effect.

Thanks for help :)


You can try something like this:

QPalette palette = menuBar->palette();
palette.setColor(QPalette::Button,  toolBar->palette().color(QPalette::Window));
menuBar->setPalette(palette);

Hope this helps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜