[Interest] Calling QCocoaMenuBar::updateMenuBarImmediately()

Jim Prouty jim at wavemetrics.com
Tue Mar 15 22:21:27 CET 2016


I'm trying to work around a problem on Macintosh where Qt 5.6 leaves the menu bar and menu items in a disabled state (Qt mistakenly believes a modal window exists, apparently).

I'd like to try calling QCocoaMenuBar::updateMenuBarImmediately() in the Qt library, implemented here:

/qtbuild5/qt/qtbase/src/plugins/platforms/cocoa/qcocoamenubar.mm:

void QCocoaMenuBar::updateMenuBarImmediately()
{
	...

Not sure if/how the QPlatform API can be used from application code to call QCocoaMenuBar::updateMenuBarImmediately.

I also seem to remember stumbling upon source that used QCocoaNativeInterface to call platform code from application source:

.../qt/qtbase/src/plugins/platforms/cocoa/qcocoanativeinterface.mm:

void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window)
{
    Q_UNUSED(window);
    QCocoaMenuBar::updateMenuBarImmediately();
}


Or would we need to patch Qt to add onAppFocusWindowChanged to QCocoaNativeInterface::platformFunction? 

QFunctionPointer QCocoaNativeInterface::platformFunction(const QByteArray &function) const
{
    if (function == QCocoaWindowFunctions::bottomLeftClippedByNSWindowOffsetIdentifier())
        return QFunctionPointer(QCocoaWindowFunctions::BottomLeftClippedByNSWindowOffset(QCocoaWindow::bottomLeftClippedByNSWindowOffsetStatic));

    return Q_NULLPTR;
}

Any pointers on how to either call updateMenuBarImmediately or use the QPlatform API from application code would be appreciated.

--Jim

===============================================

Jim Prouty

Voice: (503) 620-3001, FAX: (503) 620-6754
Makers of IGOR Pro, scientific data analysis and graphing for Mac and PC
http://www.wavemetrics.com






More information about the Interest mailing list