diff options
-rw-r--r-- | src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp | 9 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qrect.cpp | 62 | ||||
-rw-r--r-- | src/corelib/tools/qrect.h | 2 | ||||
-rw-r--r-- | src/gui/dialogs/qcolordialog_mac.mm | 12 | ||||
-rw-r--r-- | src/gui/dialogs/qfontdialog_mac.mm | 4 | ||||
-rw-r--r-- | src/gui/inputmethod/qmacinputcontext_mac.cpp | 37 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaapplicationdelegate_mac.mm | 3 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaapplicationdelegate_mac_p.h | 13 | ||||
-rw-r--r-- | src/gui/kernel/qcocoapanel_mac.mm | 6 | ||||
-rw-r--r-- | src/gui/kernel/qcocoawindow_mac.mm | 4 | ||||
-rw-r--r-- | src/gui/kernel/qcocoawindowdelegate_mac_p.h | 31 | ||||
-rw-r--r-- | src/gui/kernel/qsound_mac.mm | 11 | ||||
-rw-r--r-- | src/gui/painting/qpen.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_mac.cpp | 2 | ||||
-rw-r--r-- | src/gui/util/qsystemtrayicon_mac.mm | 19 | ||||
-rw-r--r-- | src/gui/widgets/qcocoamenu_mac_p.h | 17 | ||||
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 11 | ||||
-rw-r--r-- | tests/auto/qrect/tst_qrect.cpp | 2 |
20 files changed, 165 insertions, 90 deletions
diff --git a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp index 5691c9c..76f20b1 100644 --- a/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.cpp @@ -397,7 +397,10 @@ void PluginView::updatePluginWidget() IntRect oldWindowRect = m_windowRect; IntRect oldClipRect = m_clipRect; - m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size()); + m_windowRect = frameView->contentsToWindow(frameRect()); + IntPoint offset = topLevelOffsetFor(platformPluginWidget()); + m_windowRect.move(offset.x(), offset.y()); + m_clipRect = windowClipRect(); m_clipRect.move(-m_windowRect.x(), -m_windowRect.y()); @@ -624,10 +627,6 @@ Point PluginView::globalMousePosForPlugin() const Point pos; GetGlobalMouse(&pos); - IntPoint offset = topLevelOffsetFor(platformPluginWidget()); - pos.h -= offset.x(); - pos.v -= offset.y(); - float scaleFactor = tigerOrBetter() ? HIGetScaleFactor() : 1; pos.h = short(pos.h * scaleFactor); diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 0721c39..b4b98e1 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -279,6 +279,10 @@ namespace QT_NAMESPACE {} # endif #endif +#if defined(Q_OS_MAC64) && !defined(QT_MAC_USE_COCOA) +#error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." +#endif + #if defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN) # undef Q_OS_UNIX #elif !defined(Q_OS_UNIX) diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 2082794..b4fe070 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -2154,48 +2154,42 @@ bool QRectF::contains(const QRectF &r) const QRectF QRectF::operator|(const QRectF &r) const { - qreal l1 = xp; - qreal r1 = xp; - if (w < 0) - l1 += w; - else - r1 += w; - if (l1 == r1) // null rect + if (isNull()) return r; + if (r.isNull()) + return *this; - qreal l2 = r.xp; - qreal r2 = r.xp; - if (r.w < 0) - l2 += r.w; + qreal left = xp; + qreal right = xp; + if (w < 0) + left += w; else - r2 += r.w; - if (l2 == r2) // null rect - return *this; + right += w; - qreal t1 = yp; - qreal b1 = yp; + if (r.w < 0) { + left = qMin(left, r.xp + r.w); + right = qMax(right, r.xp); + } else { + left = qMin(left, r.xp); + right = qMax(right, r.xp + r.w); + } + + qreal top = yp; + qreal bottom = yp; if (h < 0) - t1 += h; + top += h; else - b1 += h; - if (t1 == b1) // null rect - return r; + bottom += h; - qreal t2 = r.yp; - qreal b2 = r.yp; - if (r.h < 0) - t2 += r.h; - else - b2 += r.h; - if (t2 == b2) // null rect - return *this; + if (r.h < 0) { + top = qMin(top, r.yp + r.h); + bottom = qMax(bottom, r.yp); + } else { + top = qMin(top, r.yp); + bottom = qMax(bottom, r.yp + r.h); + } - QRectF tmp; - tmp.xp = qMin(l1, l2); - tmp.yp = qMin(t1, t2); - tmp.w = qMax(r1, r2) - tmp.xp; - tmp.h = qMax(b1, b2) - tmp.yp; - return tmp; + return QRectF(left, top, right - left, bottom - top); } /*! diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index 0740fe5..efdc24d 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -653,7 +653,7 @@ inline QRectF::QRectF(const QRect &r) } inline bool QRectF::isNull() const -{ return qIsNull(w) && qIsNull(h); } +{ return w == 0. && h == 0.; } inline bool QRectF::isEmpty() const { return w <= 0. || h <= 0.; } diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 9c7a09b..1936de5 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -54,11 +54,19 @@ typedef float CGFloat; // Should only not be defined on 32-bit platforms #endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 +@protocol NSWindowDelegate <NSObject> +- (void)windowDidResize:(NSNotification *)notification; +- (BOOL)windowShouldClose:(id)window; +@end +#endif + QT_USE_NAMESPACE @class QCocoaColorPanelDelegate; -@interface QCocoaColorPanelDelegate : NSObject { +@interface QCocoaColorPanelDelegate : NSObject<NSWindowDelegate> { NSColorPanel *mColorPanel; NSView *mStolenContentView; NSButton *mOkButton; @@ -74,8 +82,6 @@ QT_USE_NAMESPACE okButton:(NSButton *)okButton cancelButton:(NSButton *)cancelButton priv:(QColorDialogPrivate *)priv; -- (BOOL)windowShouldClose:(id)window; -- (void)windowDidResize:(NSNotification *)notification; - (void)colorChanged:(NSNotification *)notification; - (void)relayout; - (void)onOkClicked; diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index e7d2f43..3dc3c00 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -78,7 +78,9 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 -@protocol NSWindowDelegate <NSObject> @end +@protocol NSWindowDelegate <NSObject> +- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize; +@end #endif diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/gui/inputmethod/qmacinputcontext_mac.cpp index 9fce64c..2e9ee08 100644 --- a/src/gui/inputmethod/qmacinputcontext_mac.cpp +++ b/src/gui/inputmethod/qmacinputcontext_mac.cpp @@ -56,13 +56,6 @@ extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); # define typeByteCount typeSInt32 #endif -static QTextFormat qt_mac_compose_format() -{ - QTextCharFormat ret; - ret.setFontUnderline(true); - return ret; -} - QMacInputContext::QMacInputContext(QObject *parent) : QInputContext(parent), composing(false), recursionGuard(false), textDocument(0), keydownEvent(0) @@ -72,7 +65,7 @@ QMacInputContext::QMacInputContext(QObject *parent) QMacInputContext::~QMacInputContext() { -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA if(textDocument) DeleteTSMDocument(textDocument); #endif @@ -81,7 +74,7 @@ QMacInputContext::~QMacInputContext() void QMacInputContext::createTextDocument() { -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA if(!textDocument) { InterfaceTypeList itl = { kUnicodeDocument }; NewTSMDocument(1, itl, &textDocument, SRefCon(this)); @@ -98,7 +91,7 @@ QString QMacInputContext::language() void QMacInputContext::mouseHandler(int pos, QMouseEvent *e) { -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA if(e->type() != QEvent::MouseButtonPress) return; @@ -107,11 +100,21 @@ void QMacInputContext::mouseHandler(int pos, QMouseEvent *e) if (pos < 0 || pos > currentText.length()) reset(); // ##### handle mouse position +#else + Q_UNUSED(pos); + Q_UNUSED(e); #endif } #if !defined QT_MAC_USE_COCOA +static QTextFormat qt_mac_compose_format() +{ + QTextCharFormat ret; + ret.setFontUnderline(true); + return ret; +} + void QMacInputContext::reset() { if (recursionGuard) @@ -134,12 +137,12 @@ bool QMacInputContext::isComposing() const { return composing; } -#endif +#endif void QMacInputContext::setFocusWidget(QWidget *w) { createTextDocument(); -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA if(w) ActivateTSMDocument(textDocument); else @@ -149,6 +152,7 @@ void QMacInputContext::setFocusWidget(QWidget *w) } +#ifndef QT_MAC_USE_COCOA static EventTypeSpec input_events[] = { { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent }, { kEventClassTextInput, kEventTextInputOffsetToPos }, @@ -156,11 +160,12 @@ static EventTypeSpec input_events[] = { }; static EventHandlerUPP input_proc_handlerUPP = 0; static EventHandlerRef input_proc_handler = 0; +#endif void QMacInputContext::initialize() { -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA if(!input_proc_handler) { input_proc_handlerUPP = NewEventHandlerUPP(QMacInputContext::globalEventProcessor); InstallEventHandler(GetApplicationEventTarget(), input_proc_handlerUPP, @@ -173,7 +178,7 @@ QMacInputContext::initialize() void QMacInputContext::cleanup() { -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA if(input_proc_handler) { RemoveEventHandler(input_proc_handler); input_proc_handler = 0; @@ -198,7 +203,7 @@ void QMacInputContext::setLastKeydownEvent(EventRef event) OSStatus QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *) { -#ifdef Q_WS_MAC32 +#ifndef QT_MAC_USE_COCOA QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData); SRefCon refcon = 0; @@ -360,6 +365,8 @@ QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void } if(!handled_event) //let the event go through return eventNotHandledErr; +#else + Q_UNUSED(event); #endif return noErr; //we eat the event } diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 353d815..ab96d58 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -259,14 +259,13 @@ static void cleanupCocoaApplicationDelegate() onApplicationChangedActivation(false); } -class QDesktopWidgetImplementation; - (void)applicationDidChangeScreenParameters:(NSNotification *)notification { Q_UNUSED(notification); QDesktopWidgetImplementation::instance()->onResize(); } -- (void)setReflectionDelegate:(NSObject *)oldDelegate +- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate { [oldDelegate retain]; [reflectionDelegate release]; diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h index 3931f16..5aa98df 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h @@ -97,7 +97,14 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 -@protocol NSApplicationDelegate <NSObject> @end +@protocol NSApplicationDelegate <NSObject> +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames; +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender; +- (void)applicationDidBecomeActive:(NSNotification *)notification; +- (void)applicationDidResignActive:(NSNotification *)notification; +@end #endif @@ -106,7 +113,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); QApplicationPrivate *qtPrivate; NSMenu *dockMenu; QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader; - id <NSApplicationDelegate> reflectionDelegate; + NSObject <NSApplicationDelegate> *reflectionDelegate; bool inLaunch; } + (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate; @@ -115,6 +122,6 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); - (QApplicationPrivate *)qAppPrivate; - (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader; - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader; -- (void)setReflectionDelegate:(NSObject *)oldDelegate; +- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate; @end #endif diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/gui/kernel/qcocoapanel_mac.mm index 266cf88..bdc7ecb 100644 --- a/src/gui/kernel/qcocoapanel_mac.mm +++ b/src/gui/kernel/qcocoapanel_mac.mm @@ -55,6 +55,12 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview. QT_END_NAMESPACE QT_USE_NAMESPACE + +@interface NSWindow (QtCoverForHackWithCategory) ++ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask; +@end + + @implementation QT_MANGLE_NAMESPACE(QCocoaPanel) - (BOOL)canBecomeKeyWindow diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/gui/kernel/qcocoawindow_mac.mm index 9c1dce5..7084416 100644 --- a/src/gui/kernel/qcocoawindow_mac.mm +++ b/src/gui/kernel/qcocoawindow_mac.mm @@ -58,6 +58,10 @@ extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview. QT_END_NAMESPACE QT_USE_NAMESPACE +@interface NSWindow (QtCoverForHackWithCategory) ++ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask; +@end + @implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration)) - (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget*)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask; diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h index b171b47..1e1d668 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h +++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h @@ -63,15 +63,8 @@ QT_FORWARD_DECLARE_CLASS(QWidget) QT_FORWARD_DECLARE_CLASS(QSize) QT_FORWARD_DECLARE_CLASS(QWidgetData) -@interface QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) : NSObject { - QHash<NSWindow *, QWidget *> *m_windowHash; - QHash<NSDrawer *, QWidget *> *m_drawerHash; -} -+ (QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)*)sharedDelegate; -- (void)becomeDelegteForWindow:(NSWindow *)window widget:(QWidget *)widget; -- (void)resignDelegateForWindow:(NSWindow *)window; -- (void)becomeDelegateForDrawer:(NSDrawer *)drawer widget:(QWidget *)widget; -- (void)resignDelegateForDrawer:(NSDrawer *)drawer; +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 +@protocol NSWindowDelegate <NSObject> - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize; - (void)windowDidMiniaturize:(NSNotification*)notification; - (void)windowDidResize:(NSNotification *)notification; @@ -83,6 +76,25 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData) - (void)windowDidResignMain:(NSNotification*)notification; - (void)windowDidBecomeKey:(NSNotification*)notification; - (void)windowDidResignKey:(NSNotification*)notification; +@end + +@protocol NSDrawerDelegate <NSObject> +- (NSSize)drawerWillResizeContents:(NSDrawer *)sender toSize:(NSSize)contentSize; +@end + +#endif + + + +@interface QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) : NSObject<NSWindowDelegate, NSDrawerDelegate> { + QHash<NSWindow *, QWidget *> *m_windowHash; + QHash<NSDrawer *, QWidget *> *m_drawerHash; +} ++ (QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)*)sharedDelegate; +- (void)becomeDelegteForWindow:(NSWindow *)window widget:(QWidget *)widget; +- (void)resignDelegateForWindow:(NSWindow *)window; +- (void)becomeDelegateForDrawer:(NSDrawer *)drawer widget:(QWidget *)widget; +- (void)resignDelegateForDrawer:(NSDrawer *)drawer; - (void)dumpMaximizedStateforWidget:(QWidget*)qwidget window:(NSWindow *)window; - (void)syncSizeForWidget:(QWidget *)qwidget toSize:(const QSize &)newSize @@ -90,6 +102,5 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData) - (NSSize)closestAcceptableSizeForWidget:(QWidget *)qwidget window:(NSWindow *)window withNewSize:(NSSize)proposedSize; - (QWidget *)qt_qwidgetForWindow:(NSWindow *)window; -- (void)checkForMove:(const NSRect &)newRect forWidget:(QWidget *)qwidget; @end #endif diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm index 43965d1..a8ee516 100644 --- a/src/gui/kernel/qsound_mac.mm +++ b/src/gui/kernel/qsound_mac.mm @@ -80,14 +80,19 @@ protected: QT_END_NAMESPACE +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 +@protocol NSSoundDelegate <NSObject> +-(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool; +@end +#endif + QT_USE_NAMESPACE -@interface QMacSoundDelegate : NSObject { +@interface QMacSoundDelegate : NSObject<NSSoundDelegate> { QSound *qSound; // may be null. QAuServerMac* server; -} +} -(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server; --(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool; @end @implementation QMacSoundDelegate diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a94c91d..6850841 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -462,8 +462,8 @@ QVector<qreal> QPen::dashPattern() const Sets the dash pattern for this pen to the given \a pattern. This implicitly converts the style of the pen to Qt::CustomDashLine. - The pattern must be specified as an even number of entries where - the entries 1, 3, 5... are the dashes and 2, 4, 6... are the + The pattern must be specified as an even number of positive entries + where the entries 1, 3, 5... are the dashes and 2, 4, 6... are the spaces. For example: \table 100% diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 3f65e42..8d5b460 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -442,7 +442,7 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) // ### copied to tools/makeqpf/qpf2.cpp -#if (defined(Q_WS_QWS) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if (defined(Q_WS_QWS) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) // see the Unicode subset bitfields in the MSDN docs static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { // Any, diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp index f596449..2f6788f 100644 --- a/src/gui/text/qfontdatabase_mac.cpp +++ b/src/gui/text/qfontdatabase_mac.cpp @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE int qt_mac_pixelsize(const QFontDef &def, int dpi); //qfont_mac.cpp int qt_mac_pointsize(const QFontDef &def, int dpi); //qfont_mac.cpp +#ifndef QT_MAC_USE_COCOA static void initWritingSystems(QtFontFamily *family, ATSFontRef atsFont) { ByteCount length = 0; @@ -81,6 +82,7 @@ qDebug() << "first char" << hex << unicodeRange[0]; for (int i = 0; i < systems.count(); ++i) family->writingSystems[systems.at(i)] = QtFontFamily::Supported; } +#endif static void initializeDb() { diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm index 370bc0c..b733db5 100644 --- a/src/gui/util/qsystemtrayicon_mac.mm +++ b/src/gui/util/qsystemtrayicon_mac.mm @@ -124,12 +124,20 @@ QT_USE_NAMESPACE -(void)mousePressed:(NSEvent *)mouseEvent; @end -@interface QNSMenu : NSMenu { + +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 + +@protocol NSMenuDelegate <NSObject> +-(void)menuNeedsUpdate:(NSMenu*)menu; +@end +#endif + + +@interface QNSMenu : NSMenu <NSMenuDelegate> { QMenu *qmenu; } -(QMenu*)menu; -(id)initWithQMenu:(QMenu*)qmenu; --(void)menuNeedsUpdate:(QNSMenu*)menu; -(void)selectedAction:(id)item; @end @@ -455,10 +463,11 @@ private: } return self; } --(QMenu*)menu { - return qmenu; +-(QMenu*)menu { + return qmenu; } --(void)menuNeedsUpdate:(QNSMenu*)menu { +-(void)menuNeedsUpdate:(NSMenu*)nsmenu { + QNSMenu *menu = static_cast<QNSMenu *>(nsmenu); emit static_cast<QSystemTrayIconQMenu*>(menu->qmenu)->doAboutToShow(); for(int i = [menu numberOfItems]-1; i >= 0; --i) [menu removeItemAtIndex:i]; diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/gui/widgets/qcocoamenu_mac_p.h index cd53692..8eb6fba 100644 --- a/src/gui/widgets/qcocoamenu_mac_p.h +++ b/src/gui/widgets/qcocoamenu_mac_p.h @@ -56,16 +56,23 @@ QT_FORWARD_DECLARE_CLASS(QMenu) -@interface QT_MANGLE_NAMESPACE(QCocoaMenu) : NSMenu -{ - QMenu *qmenu; -} -- (id)initWithQMenu:(QMenu*)menu; +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 + +@protocol NSMenuDelegate <NSObject> - (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item; - (void)menuWillOpen:(NSMenu*)menu; - (void)menuWillClose:(NSMenu*)menu; - (BOOL)hasShortcut:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier whichItem:(NSMenuItem**)outItem; +@end + +#endif + +@interface QT_MANGLE_NAMESPACE(QCocoaMenu) : NSMenu <NSMenuDelegate> +{ + QMenu *qmenu; +} +- (id)initWithQMenu:(QMenu*)menu; - (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action; @end #endif diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 981efeb..7552f18 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -173,6 +173,7 @@ private slots: void sceneBoundingRect(); void childrenBoundingRect(); void childrenBoundingRectTransformed(); + void childrenBoundingRect2(); void group(); void setGroup(); void nestedGroups(); @@ -2995,6 +2996,16 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed() QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250)); } +void tst_QGraphicsItem::childrenBoundingRect2() +{ + QGraphicsItemGroup box; + QGraphicsLineItem l1(0, 0, 100, 0, &box); + QGraphicsLineItem l2(100, 0, 100, 100, &box); + QGraphicsLineItem l3(0, 0, 0, 100, &box); + // Make sure lines (zero with/height) are included in the childrenBoundingRect. + QCOMPARE(box.childrenBoundingRect(), QRectF(0, 0, 100, 100)); +} + void tst_QGraphicsItem::group() { QGraphicsScene scene; diff --git a/tests/auto/qrect/tst_qrect.cpp b/tests/auto/qrect/tst_qrect.cpp index cdb5560..5a91636 100644 --- a/tests/auto/qrect/tst_qrect.cpp +++ b/tests/auto/qrect/tst_qrect.cpp @@ -4125,6 +4125,7 @@ void tst_QRect::unitedRect_data() QTest::newRow("test 13") << QRect() << QRect(10, 10, 10, 10) << QRect(10, 10, 10, 10); QTest::newRow("test 14") << QRect(10, 10, 10, 10) << QRect() << QRect(10, 10, 10, 10); QTest::newRow("test 15") << QRect() << QRect() << QRect(); + QTest::newRow("test 16") << QRect(0, 0, 100, 0) << QRect(0, 0, 0, 100) << QRect(0, 0, 100, 100); } void tst_QRect::unitedRect() @@ -4160,6 +4161,7 @@ void tst_QRect::unitedRectF_data() QTest::newRow("test 13") << QRectF() << QRectF(10, 10, 10, 10) << QRectF(10, 10, 10, 10); QTest::newRow("test 14") << QRectF(10, 10, 10, 10) << QRectF() << QRectF(10, 10, 10, 10); QTest::newRow("test 15") << QRectF() << QRectF() << QRectF(); + QTest::newRow("test 16") << QRectF(0, 0, 100, 0) << QRectF(0, 0, 0, 100) << QRectF(0, 0, 100, 100); } void tst_QRect::unitedRectF() |