hi all,
I want to style a Qmenubar. i want to make it transparent i.e it should take the background color of widget in which it is formed.i am using stylesheet for it .but it is not working..
i used the following code:
What to do??
Printable View
hi all,
I want to style a Qmenubar. i want to make it transparent i.e it should take the background color of widget in which it is formed.i am using stylesheet for it .but it is not working..
i used the following code:
What to do??
Put your menu bar in the widget layout and it should work. Note that QWidget has by default no space for a QMenuBar like QMainWindow has it!
thnx for reply,
I tried this but it does nt work...........
I used this way
Code:
menubar->setGeometry(10,10,40,20); menubar->addMenu(fileMenu); menubar->addMenu(actionMenu); menubar->setStyleSheet("background-color: red);"); }
But widget is not showing menubar
How to do??
You have a typo! Skip the ")".
Code:
menubar->setStyleSheet("background-color: red;");
I corrected that but still not showing the menubar
if i skip the line menubar->setStyleSheet("background-color: red;");
it shows the normal qmenubar.
what is the problem in setting stylesheet
It's because you have not put the menubar in a layout! If you don't want to do so callthen the menu bar is shown. (Skip your geometry line.)Code:
menubar->adjustSize();