PDA

View Full Version : OSX - QMenu vs QWidgetAction paints with transparent bg



migel
3rd April 2012, 23:11
Hi

Some reason below code paints a menu with transparent background. So the check box and label next to it has no background.

Any ideas why ?




QMenu *menuOther = new QMenu(tr("&Other"), this);

QCheckBox *checkbox = new QCheckBox(tr("Test"), this);
connect(checkbox, SIGNAL(toggled(bool)), parent, SLOT(button(bool)));

QWidgetAction *action = new QWidgetAction(menuOther);
action->setDefaultWidget(checkbox);

menuOther->addAction(action);
addMenu(menuOther);


$ uname -a
Darwin Mac-mini.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

Thanks for looking

Spitfire
4th April 2012, 09:54
Check parent style, maybe it has transparent background set.

migel
4th April 2012, 10:23
I don't set styling anywhere.

I have the same set Else where, QMenu inside QMenu but I don't use checkboxes there with QWidgetAction. The QWidgetAction causes this transparency but no idea how to fix it.

https://bugreports.qt-project.org/browse/QTBUG-7707?page=com.atlassian.jira.plugin.system.issueta bpanels:all-tabpanel

Looks like a bug. But what is the hack to fix it ?

I use QT 4.7.4 no idea what is the carbon vesion.