Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QWidgetAction in Menu not showing on OS X
cgarry last edited by cgarry
I am trying to add a widget (QDoubleSpinbox) to a menu using a QWidgetAction in my Qt (5.4.2) application. This is working fine on Windows, but the widget is not displayed on OS X, though a blank area is displayed where the widget should be.
This is the code that creates the menu and widget:
// QDoubleSpinbox to add to menu QDoubleSpinBox *colsat_DSpinbox = new QDoubleSpinBox; colsat_DSpinbox->setMinimum(0.0); colsat_DSpinbox->setMaximum(15.0); colsat_DSpinbox->setSingleStep(0.25); colsat_DSpinbox->setValue(1.0); connect(colsat_DSpinbox, SIGNAL(valueChanged(double)), this, SLOT(colour_saturation_changed(double))); mp_colour_saturation_Menu = playback_menu->addMenu(tr("Colour Saturation (%1)").arg(tr("Off", "No colour saturation"))); QWidgetAction *colsat_Widgetaction = new QWidgetAction(mp_colour_saturation_Menu); colsat_Widgetaction->setDefaultWidget(colsat_DSpinbox); mp_colour_saturation_Menu->addAction(colsat_Widgetaction);
(Complete code: at https://github.com/cgarry/ser-player)
The widget has been added to the Colour Saturation menu as expected when running on Windows:
The widget is missing when running on OS X (Yosemite):
The QWidgetAction documentation does say that there are some limitations on OS X, but nothing as serious as not being displayed at all. Is there a way to fix this?
cgarry last edited by
I am not sure if it helps, but I have just upgraded Qt to version 5.5.0 and the OS X version of the application still behaves the same way with the QWidgetAction still not being displayed.
I have it working with 5.6 (beta stage). Can you post a minimal QMainWindow implementation that triggers this ?
I have it working with 5.6 (beta stage).
I currently don't have a Mac to text this on, but Qt uses the system menubar when a (top-levle) QMenuBar is used. I could imagine that there are no widget actions supported.
QMainWindow widget of course still have a it's own menubar though, with working widget actions since it is completely handled by Qt.
Sorry, I've haven't given enough info: it's working on 10.8.5 with a Qt 5.6 build