From e3cf87bb754b10eae4c6d852d912d1b107ee03ed Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 26 Jun 2013 10:22:54 +0200 Subject: Mac OSX: get the correct key code when the control key is pressed The control key results in modifiers having Qt::MetaModifier, and then the correct character is found in charactersIgnoringModifiers. The rest of the time, [nsevent characters] seems to be correct. If we use charactersIgnoringModifiers too much of the time, then the keycode will be wrong in some cases even though typing is still possible. Task-number: QTBUG-29005 Task-number: QTBUG-31811 Task-number: QTBUG-31977 Change-Id: Ib23b89f03bc9a61fe6d177320fa603c05649e979 Reviewed-by: Eike Ziller Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qnsview.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ab3f495a60..94b414a882 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -914,6 +914,7 @@ static QTouchDevice *touchDevice = 0; ulong timestamp = [nsevent timestamp] * 1000; ulong nativeModifiers = [nsevent modifierFlags]; Qt::KeyboardModifiers modifiers = [QNSView convertKeyModifiers: nativeModifiers]; + NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers]; NSString *characters = [nsevent characters]; // [from Qt 4 impl] There is no way to get the scan code from carbon. But we cannot @@ -928,7 +929,10 @@ static QTouchDevice *touchDevice = 0; QChar ch = QChar::ReplacementCharacter; int keyCode = Qt::Key_unknown; if ([characters length] != 0) { - ch = QChar([characters characterAtIndex:0]); + if ((modifiers & Qt::MetaModifier) && ([charactersIgnoringModifiers length] != 0)) + ch = QChar([charactersIgnoringModifiers characterAtIndex:0]); + else + ch = QChar([characters characterAtIndex:0]); keyCode = [self convertKeyCode:ch]; } -- cgit v1.2.3 From c4dfd13f7881b9029aaa1d5b8561492bd9026e98 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 27 Jun 2013 15:07:07 +0200 Subject: Cocoa: Don't update the menubar when popups are shown Task-number: QTBUG-31532 Change-Id: I86084cb96bd1dd253b3e2e4413c06de053b95b3b Reviewed-by: Romain Perier Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoamenubar.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 73331db40d..8d1ca88b8e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -203,6 +203,11 @@ void QCocoaMenuBar::updateMenuBarImmediately() QCocoaAutoReleasePool pool; QCocoaMenuBar *mb = findGlobalMenubar(); QCocoaWindow *cw = findWindowForMenubar(); + + QWindow *win = cw ? cw->window() : 0; + if (win && (win->flags() & Qt::Popup) == Qt::Popup) + return; // context menus, comboboxes, etc. don't need to update the menubar + if (cw && cw->menubar()) mb = cw->menubar(); -- cgit v1.2.3 From 0aa067504006a177191f6a6644069b7109b980e3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 27 Jun 2013 16:39:05 +0200 Subject: Cocoa: Simplify qt_mac_cgimage_to_nsimage code Since 10.6, NSImage has a sensible contructor for that. Change-Id: Ie753135ebb37630c1a70c395689bf85d4a4a01de Reviewed-by: Jake Petroules Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 066b2d9cc1..1b3db9f63a 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -124,16 +124,7 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &img) NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image) { - QCocoaAutoReleasePool pool; - NSImage *newImage = 0; - NSRect imageRect = NSMakeRect(0.0, 0.0, CGImageGetWidth(image), CGImageGetHeight(image)); - newImage = [[NSImage alloc] initWithSize:imageRect.size]; - [newImage lockFocus]; - { - CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - CGContextDrawImage(imageContext, *(CGRect*)&imageRect, image); - } - [newImage unlockFocus]; + NSImage *newImage = [[NSImage alloc] initWithCGImage:image size:NSZeroSize]; return newImage; } -- cgit v1.2.3 From 93e79d865c127aad0de0a44007253845cb291b4a Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 28 Jun 2013 17:32:08 +0200 Subject: Cocoa: Let Cocoa pick the right pixmap for menu item icons Task-number: QTBUG-31477 Change-Id: Iac2d13b68d36c691b60685b69cd390958c35fae3 Reviewed-by: James Turner Reviewed-by: Jake Petroules Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoahelpers.h | 1 + src/plugins/platforms/cocoa/qcocoahelpers.mm | 18 ++++++++++++++++++ src/plugins/platforms/cocoa/qcocoamenuitem.mm | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index c801d9d926..3e402673f3 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -71,6 +71,7 @@ inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qst CGImageRef qt_mac_image_to_cgimage(const QImage &image); NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_create_nsimage(const QPixmap &pm); +NSImage *qt_mac_create_nsimage(const QIcon &icon); NSSize qt_mac_toNSSize(const QSize &qtSize); NSRect qt_mac_toNSRect(const QRect &rect); diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 1b3db9f63a..09d1a96789 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -139,6 +139,24 @@ NSImage *qt_mac_create_nsimage(const QPixmap &pm) return nsImage; } +NSImage *qt_mac_create_nsimage(const QIcon &icon) +{ + if (icon.isNull()) + return nil; + + NSImage *nsImage = [[NSImage alloc] init]; + foreach (QSize size, icon.availableSizes()) { + QPixmap pm = icon.pixmap(size); + QImage image = pm.toImage(); + CGImageRef cgImage = qt_mac_image_to_cgimage(image); + NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; + [nsImage addRepresentation:imageRep]; + [imageRep release]; + CGImageRelease(cgImage); + } + return nsImage; +} + HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion ®ion) { HIMutableShapeRef shape = HIShapeCreateMutable(); diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 1e2b593a08..6d8174c667 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -310,7 +310,8 @@ NSMenuItem *QCocoaMenuItem::sync() } if (!m_icon.isNull()) { - NSImage *img = static_cast(qt_mac_create_nsimage(m_icon.pixmap(16, QIcon::Normal))); + NSImage *img = qt_mac_create_nsimage(m_icon); + [img setSize:NSMakeSize(16, 16)]; [m_native setImage: img]; [img release]; } -- cgit v1.2.3 From e8c3316ab03584fe18e4e2d49fcb1a70a7231d16 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 27 Jun 2013 18:41:31 +0200 Subject: Cocoa: Re-establish platform menu QObject hierarchy This amends commit 119882714f87ffeb6945fdb2d02997ae125ff50c. Change-Id: Ifb105596af5b00b04344cb665b3e68292c9187ae Reviewed-by: Romain Perier Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoamenu.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index d4cf83a380..bd406ee176 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -49,6 +49,7 @@ #include #include "qcocoaapplication.h" #include "qcocoamenuloader.h" +#include "qcocoamenubar.h" #include "qcocoawindow.h" #import "qnsview.h" @@ -538,6 +539,7 @@ void QCocoaMenu::syncModalState(bool modal) void QCocoaMenu::setMenuBar(QCocoaMenuBar *menuBar) { m_menuBar = menuBar; + setParent(menuBar); } QCocoaMenuBar *QCocoaMenu::menuBar() const -- cgit v1.2.3 From 323164f5fbfbd56c1a0c2d856e440a87b0ed73c7 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 2 Jul 2013 15:21:07 +0200 Subject: Avoid warnings when fetching file icons without a CGContextRef This can happen when instantiating a QFileIconProvider and no suitable graphics context is available (e.g., when only using a QQuickView). The proper, longer (5.2) term solution would be to have the platform theme return a QIcon with a NSImage icon provider. Task-number: QTBUG-31908 Change-Id: Ibfdb51e0a7dd2c33761a463f4eb6619f0aca19f0 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/cocoa/qcocoatheme.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 9c10bc26dd..13a387a0a3 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -258,8 +258,9 @@ QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &siz return QPixmap(); NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height()); + NSGraphicsContext *gc = [NSGraphicsContext currentContext]; CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect - context:[NSGraphicsContext currentContext] + context:([gc graphicsPort] ? gc : nil) hints:nil]; QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage)); return pixmap; -- cgit v1.2.3 From eeffcfbd89a0b386c5757e8c67b76c5bccc84ffd Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 28 Jun 2013 17:26:27 +0200 Subject: Cocoa: fix shared color panel usage Task-number: QTBUG-31819 Change-Id: I60162f4c4af8aaae02ba7be11b2793ad29c5e2b5 Reviewed-by: Gabriel de Dietrich --- .../platforms/cocoa/qcocoacolordialoghelper.h | 9 - .../platforms/cocoa/qcocoacolordialoghelper.mm | 257 ++++++++++++--------- 2 files changed, 144 insertions(+), 122 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h index e30f1d7425..59e029769d 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h @@ -59,15 +59,6 @@ public: void setCurrentColor(const QColor&); QColor currentColor() const; - -public: - bool showCocoaColorPanel(Qt::WindowModality windowModality, QWindow *parent); - bool hideCocoaColorPanel(); - - void createNSColorPanelDelegate(); - -private: - void *mDelegate; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 594ad65a18..3379a26650 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -89,11 +89,14 @@ static NSButton *macCreateButton(const char *text, NSView *superview) @implementation QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) -- (id)initWithDialogHelper:(QCocoaColorDialogHelper *)helper +- (id)init { self = [super init]; mColorPanel = [NSColorPanel sharedColorPanel]; - mHelper = helper; + mHelper = 0; + mStolenContentView = 0; + mOkButton = 0; + mCancelButton = 0; mResultCode = NSCancelButton; mDialogIsExecuting = false; mResultSet = false; @@ -103,11 +106,31 @@ static NSButton *macCreateButton(const char *text, NSView *superview) [mColorPanel setRestorable:NO]; #endif + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(colorChanged:) + name:NSColorPanelColorDidChangeNotification + object:mColorPanel]; + + [mColorPanel retain]; + return self; +} + +- (void)dealloc +{ + [self restoreOriginalContentView]; + [mColorPanel setDelegate:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [super dealloc]; +} + +- (void)setDialogHelper:(QCocoaColorDialogHelper *)helper +{ + mHelper = helper; + [mColorPanel setShowsAlpha:mHelper->options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) { - mStolenContentView = 0; - mOkButton = 0; - mCancelButton = 0; - } else { + [self restoreOriginalContentView]; + } else if (!mStolenContentView) { // steal the color panel's contents view mStolenContentView = [mColorPanel contentView]; [mStolenContentView retain]; @@ -132,33 +155,6 @@ static NSButton *macCreateButton(const char *text, NSView *superview) [mCancelButton setAction:@selector(onCancelClicked)]; [mCancelButton setTarget:self]; } - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(colorChanged:) - name:NSColorPanelColorDidChangeNotification - object:mColorPanel]; - - [mColorPanel retain]; - return self; -} - -- (void)dealloc -{ - if (mOkButton) { - NSView *ourContentView = [mColorPanel contentView]; - - // return stolen stuff to its rightful owner - [mStolenContentView removeFromSuperview]; - [mColorPanel setContentView:mStolenContentView]; - [mOkButton release]; - [mCancelButton release]; - [ourContentView release]; - } - - [mColorPanel setDelegate:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [super dealloc]; } - (void)closePanel @@ -176,7 +172,25 @@ static NSButton *macCreateButton(const char *text, NSView *superview) { Q_UNUSED(notification); [self updateQtColor]; - emit mHelper->colorSelected(mQtColor); + if (mHelper) + emit mHelper->colorSelected(mQtColor); +} + +- (void)restoreOriginalContentView +{ + if (mStolenContentView) { + NSView *ourContentView = [mColorPanel contentView]; + + // return stolen stuff to its rightful owner + [mStolenContentView removeFromSuperview]; + [mColorPanel setContentView:mStolenContentView]; + [mOkButton release]; + [mCancelButton release]; + [ourContentView release]; + mOkButton = 0; + mCancelButton = 0; + mStolenContentView = 0; + } } - (void)relayout @@ -273,7 +287,8 @@ static NSButton *macCreateButton(const char *text, NSView *superview) mQtColor.setRgbF(red, green, blue, alpha); } } - emit mHelper->currentColorChanged(mQtColor); + if (mHelper) + emit mHelper->currentColorChanged(mQtColor); } - (void)showModelessPanel @@ -310,7 +325,8 @@ static NSButton *macCreateButton(const char *text, NSView *superview) [self finishOffWithCode:NSCancelButton]; } else { mResultSet = true; - emit mHelper->reject(); + if (mHelper) + emit mHelper->reject(); } return true; } @@ -345,27 +361,101 @@ static NSButton *macCreateButton(const char *text, NSView *superview) QT_BEGIN_NAMESPACE -QCocoaColorDialogHelper::QCocoaColorDialogHelper() : - mDelegate(0) +class QCocoaColorPanel +{ +public: + QCocoaColorPanel() + { + mDelegate = [[QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) alloc] init]; + } + + ~QCocoaColorPanel() + { + [mDelegate release]; + } + + void init(QCocoaColorDialogHelper *helper) + { + [mDelegate setDialogHelper:helper]; + } + + void cleanup(QCocoaColorDialogHelper *helper) + { + if (mDelegate->mHelper == helper) + mDelegate->mHelper = 0; + } + + bool exec() + { + // Note: If NSApp is not running (which is the case if e.g a top-most + // QEventLoop has been interrupted, and the second-most event loop has not + // yet been reactivated (regardless if [NSApp run] is still on the stack)), + // showing a native modal dialog will fail. + return [mDelegate runApplicationModalPanel]; + } + + bool show(Qt::WindowModality windowModality, QWindow *parent) + { + Q_UNUSED(parent); + if (windowModality != Qt::WindowModal) + [mDelegate showModelessPanel]; + // no need to show a Qt::WindowModal dialog here, because it's necessary to call exec() in that case + return true; + } + + void hide() + { + [mDelegate closePanel]; + } + + QColor currentColor() const + { + return mDelegate->mQtColor; + } + + void setCurrentColor(const QColor &color) + { + // make sure that if ShowAlphaChannel option is set then also setShowsAlpha + // needs to be set, otherwise alpha value is omitted + if (color.alpha() < 255) + [mDelegate->mColorPanel setShowsAlpha:YES]; + + NSColor *nsColor; + const QColor::Spec spec = color.spec(); + if (spec == QColor::Cmyk) { + nsColor = [NSColor colorWithDeviceCyan:color.cyanF() + magenta:color.magentaF() + yellow:color.yellowF() + black:color.blackF() + alpha:color.alphaF()]; + } else { + nsColor = [NSColor colorWithCalibratedRed:color.redF() + green:color.greenF() + blue:color.blueF() + alpha:color.alphaF()]; + } + mDelegate->mQtColor = color; + [mDelegate->mColorPanel setColor:nsColor]; + } + +private: + QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *mDelegate; +}; + +Q_GLOBAL_STATIC(QCocoaColorPanel, sharedColorPanel) + +QCocoaColorDialogHelper::QCocoaColorDialogHelper() { } QCocoaColorDialogHelper::~QCocoaColorDialogHelper() { - if (!mDelegate) - return; - [reinterpret_cast(mDelegate) release]; - mDelegate = 0; + sharedColorPanel()->cleanup(this); } void QCocoaColorDialogHelper::exec() { - // Note: If NSApp is not running (which is the case if e.g a top-most - // QEventLoop has been interrupted, and the second-most event loop has not - // yet been reactivated (regardless if [NSApp run] is still on the stack)), - // showing a native modal dialog will fail. - QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast(mDelegate); - if ([delegate runApplicationModalPanel]) + if (sharedColorPanel()->exec()) emit accept(); else emit reject(); @@ -375,83 +465,24 @@ bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowMod { if (windowModality == Qt::WindowModal) windowModality = Qt::ApplicationModal; - return showCocoaColorPanel(windowModality, parent); + sharedColorPanel()->init(this); + return sharedColorPanel()->show(windowModality, parent); } void QCocoaColorDialogHelper::hide() { - if (!mDelegate) - return; - [reinterpret_cast(mDelegate)->mColorPanel close]; + sharedColorPanel()->hide(); } void QCocoaColorDialogHelper::setCurrentColor(const QColor &color) { - if (!mDelegate) - createNSColorPanelDelegate(); - QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast(mDelegate); - - // make sure that if ShowAlphaChannel option is set then also setShowsAlpha - // needs to be set, otherwise alpha value is omitted - [delegate->mColorPanel setShowsAlpha:options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; - - NSColor *nsColor; - const QColor::Spec spec = color.spec(); - if (spec == QColor::Cmyk) { - nsColor = [NSColor colorWithDeviceCyan:color.cyanF() - magenta:color.magentaF() - yellow:color.yellowF() - black:color.blackF() - alpha:color.alphaF()]; - } else { - nsColor = [NSColor colorWithCalibratedRed:color.redF() - green:color.greenF() - blue:color.blueF() - alpha:color.alphaF()]; - } - delegate->mQtColor = color; - [delegate->mColorPanel setColor:nsColor]; + sharedColorPanel()->init(this); + sharedColorPanel()->setCurrentColor(color); } QColor QCocoaColorDialogHelper::currentColor() const { - if (!mDelegate) - return QColor(); - return reinterpret_cast(mDelegate)->mQtColor; -} - -void QCocoaColorDialogHelper::createNSColorPanelDelegate() -{ - if (mDelegate) - return; - - QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) alloc] - initWithDialogHelper:this]; - - mDelegate = delegate; -} - -bool QCocoaColorDialogHelper::showCocoaColorPanel(Qt::WindowModality windowModality, QWindow *parent) -{ - Q_UNUSED(parent); - createNSColorPanelDelegate(); - QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast(mDelegate); - [delegate->mColorPanel setShowsAlpha:options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; - if (windowModality != Qt::WindowModal) - [delegate showModelessPanel]; - // no need to show a Qt::WindowModal dialog here, because it's necessary to call exec() in that case - return true; -} - -bool QCocoaColorDialogHelper::hideCocoaColorPanel() -{ - if (!mDelegate){ - return false; - } else { - QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast(mDelegate); - [delegate closePanel]; - return true; - } + return sharedColorPanel()->currentColor(); } QT_END_NAMESPACE -- cgit v1.2.3 From 4634b7516d3c3a62c239f1e4f7a308ba0603bcdb Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Tue, 2 Jul 2013 14:57:32 +0400 Subject: Remove qWarning() in qt_mac_image_to_cgimage() Change-Id: I839aa44735910012bf57daa9c8b55c5e6def3cd2 Reviewed-by: James Turner Reviewed-by: Gabriel de Dietrich Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 09d1a96789..3ade0a2a45 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -84,11 +84,8 @@ static void drawImageReleaseData (void *info, const void *, size_t) CGImageRef qt_mac_image_to_cgimage(const QImage &img) { - if (img.width() <= 0 || img.height() <= 0) { - qWarning() << Q_FUNC_INFO << - "trying to set" << img.width() << "x" << img.height() << "size for CGImage"; + if (img.isNull()) return 0; - } QImage *image; if (img.depth() != 32) -- cgit v1.2.3