From 4993acb83e7b9e118bfad45f02864a26013797f5 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 14 Jul 2009 10:36:39 +0200 Subject: use qt_mac_QStringToNString & qt_mac_NSStringToQString These functions hide all this horrible casting and we've had them for a while. When I see them, I try to replace them as it keeps the code much more readable. --- src/gui/kernel/qwidget_mac.mm | 6 ++---- src/gui/widgets/qcocoatoolbardelegate_mac.mm | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 5e2dfb6..6cdb5fe 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2864,8 +2864,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) SetWindowTitleWithCFString(qt_mac_window_for(q), QCFString(caption)); #else QMacCocoaAutoReleasePool pool; - [qt_mac_window_for(q) - setTitle:reinterpret_cast(static_cast(QCFString(caption)))]; + [qt_mac_window_for(q) setTitle:qt_mac_QStringToNSString(caption)]; #endif } } @@ -2977,8 +2976,7 @@ void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) SetWindowAlternateTitle(qt_mac_window_for(q), QCFString(iconText)); #else QMacCocoaAutoReleasePool pool; - [qt_mac_window_for(q) - setMiniwindowTitle:reinterpret_cast(static_cast(QCFString(iconText)))]; + [qt_mac_window_for(q) setMiniwindowTitle:qt_mac_QStringToNSString(iconText)]; #endif } } diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/gui/widgets/qcocoatoolbardelegate_mac.mm index 894028e..865069e 100644 --- a/src/gui/widgets/qcocoatoolbardelegate_mac.mm +++ b/src/gui/widgets/qcocoatoolbardelegate_mac.mm @@ -43,6 +43,7 @@ #ifdef QT_MAC_USE_COCOA #include #include +#include #include #include #include @@ -99,7 +100,7 @@ QT_FORWARD_DECLARE_CLASS(QCFString); { Q_UNUSED(flag); Q_UNUSED(nstoolbar); - QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(QCFString::toQString(CFStringRef(itemIdentifier))); + QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString(itemIdentifier)); NSToolbarItem *item = nil; if (tb) { item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; @@ -111,7 +112,7 @@ QT_FORWARD_DECLARE_CLASS(QCFString); - (void)toolbarWillAddItem:(NSNotification *)notification { NSToolbarItem *item = [[notification userInfo] valueForKey:@"item"]; - QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(QCFString::toQString(CFStringRef([item itemIdentifier]))); + QToolBar *tb = mainWindowLayout->cocoaItemIDToToolbarHash.value(qt_mac_NSStringToQString([item itemIdentifier])); if (!tb) return; // I can't really do anything about this. [item retain]; -- cgit v0.12