diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-01-17 14:40:35 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-19 11:31:22 +0100 |
commit | a84d893bae6b282381f9e1c55a34cd223d7351ed (patch) | |
tree | 7af52d91463db5507269eefd82b2da28c13df272 /tests | |
parent | e87813bfa239e2083bda5ecc8172753ecc8de5f1 (diff) |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm index 8d828dd5a7..0d93f7528b 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm @@ -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]; } |