QWidgetAction in Menu not showing on OS X



  • 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:
    Windows version

    The widget is missing when running on OS X (Yosemite):
    OS X version

    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?



  • 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.


  • Lifetime Qt Champion

    Hi,

    I have it working with 5.6 (beta stage). Can you post a minimal QMainWindow implementation that triggers this ?


  • Moderators

    @SGaist said:

    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.


  • Lifetime Qt Champion

    Sorry, I've haven't given enough info: it's working on 10.8.5 with a Qt 5.6 build


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.