summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-11-02 15:34:15 +0100
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-11-02 15:50:09 +0100
commitf1132e60e0759d8be043a2c4312915b3103004ff (patch)
treecd29f8e683018aa3eafb0dd6618a4b1f1370b74f /src/gui
parentd55483a656285d30095ab002ec8380340842c89c (diff)
Titlebar icon (for e.g. Assistant) not visible in Cocoa.
standardWindowButton:NSWindowDocumentIconButton will not return a valid NSButton unless you call setRepresentedURL or setRepresentedFilename for the NSWindow. This patch makes sure that setWindowIcon_sys() sets the icon using a valid NSButton. Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm23
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac_p.h2
-rw-r--r--src/gui/kernel/qwidget_mac.mm6
3 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 95c89e5b5e..803a1b1c83 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -346,5 +346,28 @@ static void cleanupCocoaWindowDelegate()
m_drawerHash->remove(drawer);
}
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
+{
+ Q_UNUSED(menu);
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget && !qwidget->windowFilePath().isEmpty()) {
+ return YES;
+ }
+ return NO;
+}
+
+- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event
+ from:(NSPoint)dragImageLocation
+ withPasteboard:(NSPasteboard *)pasteboard
+{
+ Q_UNUSED(event);
+ Q_UNUSED(dragImageLocation);
+ Q_UNUSED(pasteboard);
+ QWidget *qwidget = m_windowHash->value(window);
+ if (qwidget && !qwidget->windowFilePath().isEmpty()) {
+ return YES;
+ }
+ return NO;
+}
@end
#endif// QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
index a06c516720..3728002fc4 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h
+++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h
@@ -76,6 +76,8 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData)
- (void)windowDidResignMain:(NSNotification*)notification;
- (void)windowDidBecomeKey:(NSNotification*)notification;
- (void)windowDidResignKey:(NSNotification*)notification;
+- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu;
+- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard;
@end
@protocol NSDrawerDelegate <NSObject>
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 58252ca354..79f55a101d 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3017,6 +3017,12 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
#else
QMacCocoaAutoReleasePool pool;
NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
+ if (iconButton == nil) {
+ QCFString string(q->windowTitle());
+ const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
+ [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]];
+ iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
+ }
if (icon.isNull()) {
[iconButton setImage:nil];
} else {