From cee63e2c17c8e83a4366741da0cbd5fc852e5835 Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Tue, 6 Sep 2011 14:10:50 +0200 Subject: Cocoa: QMenu refactor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change prepares for enabling native menus on OS X. Move code from src/widgets to cocoa: - qcocoaapplicaiton - qcocoaapplicaitondelegate - qcocoamenuloader - qcocoamenu - qmenu_mac - misc helpers to qcocoahelpers Create a QNSApplication and QCocoaApplicationDelegate at application startup. New Lighthouse API: - class QPlatformMenu - class QPlatformMenuBar - QPlatformIntegration::createPlatformMenu() - QPlatformIntegration::createPlatformMenuBar() Platforms that wants a native menu integration subclasses QPlatformMenu[|Bar] and implements the create function. The default implementation returns 0, which causes QMenu to use the standard Qt menus. This API is based on the current native menu abstraction that Mac, Wince and S60 uses in Qt 4. The main difference is that the platform classes are proper standalone classes and not #ifdeffed into QMenuPrivate. Change-Id: I3da41f80b0ae903a476937908b1f9b88014b7954 Reviewed-on: http://codereview.qt.nokia.com/4068 Reviewed-by: Morten Johan Sørvig --- src/corelib/kernel/qcoreapplication.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 7252a34a2d..d716c7b0f6 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -743,20 +743,6 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on) QCoreApplicationPrivate::attribs |= 1 << attribute; else QCoreApplicationPrivate::attribs &= ~(1 << attribute); -#ifdef Q_OS_MAC - // Turn on the no native menubar here, since we used to - // do this implicitly. We DO NOT flip it off if someone sets - // it to false. - // Ideally, we'd have magic that would be something along the lines of - // "follow MacPluginApplication" unless explicitly set. - // Considering this attribute isn't only at the beginning - // it's unlikely it will ever be a problem, but I want - // to have the behavior documented here. - if (attribute == Qt::AA_MacPluginApplication && on - && !testAttribute(Qt::AA_DontUseNativeMenuBar)) { - setAttribute(Qt::AA_DontUseNativeMenuBar, true); - } -#endif } /*! -- cgit v1.2.3