PDA

View Full Version : background color of menu bar



sabeesh
24th July 2007, 10:12
Hi,
How can I set the background color of menu bar as black in a QMainWindow.

rajesh
24th July 2007, 10:49
try same code as main window.
change m_pMenu with your menu variable.


QPalette palette;
palette.setColor(m_pMenu->backgroundRole(), Qt::black);
m_pMenu->setPalette(palette);

sabeesh
24th July 2007, 11:27
Hi,
Thankyou, it is working
:)
Sabeesh

sabeesh
24th July 2007, 12:15
Hi,
One small problem found. When I use the above command, then I can change the background colour of menu bar. But the problem is that, when I add a Table Widet, then its Scrollbar color and Column and Row heading color also change. I need to change only the menubar color of Main Window. How can I do this.
:(
Sabeesh

rajesh
24th July 2007, 12:23
can you post your code here? how you changing the color of menu?

sabeesh
24th July 2007, 12:28
Hi,
This is the code,

QPalette palette;
palette.setColor(menubar->backgroundRole(), Qt::black);
palette.setColor(menubar->foregroundRole(), Qt::white);
menubar->setPalette(palette);

Sabeesh

sabeesh
24th July 2007, 12:48
Hi,
I have a Table View in my form. I had add some rows into that Table Widget. I need to hide the row heading of that Table Widget. How can i do that. Please help me.
:(
Sabeesh