Add "nswindow" resource to the Cocoa native interface implementation
This will return the NSWindow* for the given QWindow*. Port the QWidget autotest helper to use the native interface and the "nswindow" resource. Change-Id: I754b7e9288690ac3c99c3ec65c5526d5fe121234 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>bb10
parent
e87813bfa2
commit
a84d893bae
|
|
@ -61,6 +61,8 @@ void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceS
|
|||
return static_cast<QCocoaWindow *>(window->handle())->currentContext()->nsOpenGLContext();
|
||||
} else if (resourceString == "nsview") {
|
||||
return static_cast<QCocoaWindow *>(window->handle())->m_contentView;
|
||||
} else if (resourceString == "nswindow") {
|
||||
return static_cast<QCocoaWindow *>(window->handle())->m_nsWindow;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,23 +40,28 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "tst_qwidget_mac_helpers.h"
|
||||
#include <private/qt_mac_p.h>
|
||||
#include <private/qt_cocoa_helpers_mac_p.h>
|
||||
#include <QApplication>
|
||||
#include <QPlatformNativeInterface>
|
||||
#include <private/qcore_mac_p.h>
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
QString nativeWindowTitle(QWidget *window, Qt::WindowState state)
|
||||
{
|
||||
OSWindowRef windowRef = qt_mac_window_for(window);
|
||||
QWindow *qwindow = window->windowHandle();
|
||||
NSWindow *nswindow = (NSWindow *) qApp->platformNativeInterface()->nativeResourceForWindow("nswindow", qwindow);
|
||||
QCFString macTitle;
|
||||
if (state == Qt::WindowMinimized) {
|
||||
macTitle = reinterpret_cast<CFStringRef>([[windowRef miniwindowTitle] retain]);
|
||||
macTitle = reinterpret_cast<CFStringRef>([[nswindow miniwindowTitle] retain]);
|
||||
} else {
|
||||
macTitle = reinterpret_cast<CFStringRef>([[windowRef title] retain]);
|
||||
macTitle = reinterpret_cast<CFStringRef>([[nswindow title] retain]);
|
||||
}
|
||||
return macTitle;
|
||||
}
|
||||
|
||||
bool nativeWindowModified(QWidget *widget)
|
||||
{
|
||||
return [qt_mac_window_for(widget) isDocumentEdited];
|
||||
QWindow *qwindow = widget->windowHandle();
|
||||
NSWindow *nswindow = (NSWindow *) qApp->platformNativeInterface()->nativeResourceForWindow("nswindow", qwindow);
|
||||
return [nswindow isDocumentEdited];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue