anupamgee
28th April 2009, 12:27
hi all,
i want to change the background color of Qmenu.
i tried the following code:
TabWindow::TabWindow(QWidget *parent) : QWidget(parent)
{
QMenu *menu=new QMenu(this);
onlineAct = new QAction(tr("Online"), this);
busyAct = new QAction(tr("Busy"), this);
menu->addAction(onlineAct);
menu->addAction(busyAct);
connect(onlineAct,SIGNAL(triggered()),this,SLOT(on line()));
connect(busyAct,SIGNAL(triggered()),this,SLOT(busy ()));
menu->setAutoFillBackground(true);
QPalette palette=menu->palette();
palette.setColor(QPalette::Window, Qt::blue);
menu->setPalette(palette);
}
but the color is not changing.It is showing white background color.
what to do??
i want to change the background color of Qmenu.
i tried the following code:
TabWindow::TabWindow(QWidget *parent) : QWidget(parent)
{
QMenu *menu=new QMenu(this);
onlineAct = new QAction(tr("Online"), this);
busyAct = new QAction(tr("Busy"), this);
menu->addAction(onlineAct);
menu->addAction(busyAct);
connect(onlineAct,SIGNAL(triggered()),this,SLOT(on line()));
connect(busyAct,SIGNAL(triggered()),this,SLOT(busy ()));
menu->setAutoFillBackground(true);
QPalette palette=menu->palette();
palette.setColor(QPalette::Window, Qt::blue);
menu->setPalette(palette);
}
but the color is not changing.It is showing white background color.
what to do??