[Qt-interest] how to set QMenu`s background Transparent

ja chen mr.chenja at gmail.com
Wed May 26 04:23:36 CEST 2010


hello all,
I encountered a problem with setting background. and I have no idea how to
deal with it.

there is probelm:
In my program, i created a custom class with QGridLayout member and inherit
from QWidget.like beblow:
class customClass
{
......
......
 private:
   QGridLayout* mGridLayout_;
}
i set many buttons into GridLayout,and create a QWidgetAction which it`s
defaultWidget is customClass.look like below:
QWidgetAction* action;
action->setDefaultWidget(customClassObj);

after all these operation,i set this "action" to QMenu.

all above is Ok, my problem is how to set QMenu`s background Transparent.
when i push QMenu button,Menu appeared.but it`s background is not
Transparent,so i can`s see main window.
how can i set Menu`s background Transparent. i test many method,but no one
has worked.
such as using stylesheet or setBackgroundColor(Qt::Transparent).when i code
like this,the Menu`s background become
black,or has no effects.my qt version is 4.5.0.   OS:windows Xp.

if someone know about this,please point me to the right direction,i will
appreciate.

best wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100526/89f75037/attachment.html 


More information about the Qt-interest-old mailing list