PDA

View Full Version : problem with QMenu::icon border



sattu
20th May 2013, 14:32
Hi Everyone,

I don't want any border for the icon of my QMenu but the border appears for the icon when an item gets selected. I am using the following stylesheet but it doesn't work:-



setStyleSheet(QString::fromUtf8("QMenu\n"
"{\n"
"background: none;background-color: green;color:white;\n"
"}\n"
"QMenu::item:selected\n"
"{ \n"
"background-color: blue;\n"
"}\n"
"QMenu::icon:checked\n"
"{ \n"
"border: none;\n"
"}"));

I tried to follow the examples given in http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/libqt4/stylesheet-examples.html#customizing-qmenu but it doesn't help. For the items which don't have focus the icons appear without any border. But for the selected item the icons come with a border :confused: . I would be glad if someone would help me with this.

-thanks
sattu

kmamutov
2nd July 2013, 15:27
Hi!
You can use something like this:



setStyleSheet(QMenu::item:selected{border:none;});

but you also need to set item padding:


setStyleSheet("QMenu::item{padding-left: (value here)px;}