From f5c3226f587553d2af1d2ef273d653e226c914b9 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 31 Mar 2012 23:22:05 +0900 Subject: change NSTextInput to NSTextInputClient in Cocoa plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NSTextInput protocol is slated for deprecation Task-number: QTBUG-23867 Change-Id: I3f9eadc31bdf4234c63f1bcde5172f22da8d340e Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.h | 2 +- src/plugins/platforms/cocoa/qnsview.mm | 46 ++++++++++++++++------------------ 2 files changed, 23 insertions(+), 25 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 2b7caae688..aba9a2dc65 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QCocoaWindow; QT_END_NAMESPACE -@interface QNSView : NSView { +@interface QNSView : NSView { CGImageRef m_cgImage; QWindow *m_window; QCocoaWindow *m_platformWindow; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index e76c02704f..66f5d125f7 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -681,8 +681,9 @@ static QTouchDevice *touchDevice = 0; [self tryToPerform:aSelector with:self]; } -- (void) insertText:(id)aString +- (void) insertText:(id)aString replacementRange:(NSRange)replacementRange { + Q_UNUSED(replacementRange) QString commitString; if ([aString length]) { if ([aString isKindOfClass:[NSAttributedString class]]) { @@ -707,12 +708,13 @@ static QTouchDevice *touchDevice = 0; m_composingText.clear(); } -- (void) setMarkedText:(id)aString selectedRange:(NSRange)selRange +- (void) setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { + Q_UNUSED(replacementRange) QString preeditString; QList attrs; - attrs<((CFStringRef)string); return [[[NSAttributedString alloc] initWithString:const_cast(tmpString)] autorelease]; } @@ -831,34 +829,34 @@ static QTouchDevice *touchDevice = 0; return range; } - - (NSRange) selectedRange { - NSRange selRange = {NSNotFound, 0}; - selRange.location = NSNotFound; - selRange.length = 0; + NSRange selectedRange = {NSNotFound, 0}; + selectedRange.location = NSNotFound; + selectedRange.length = 0; QObject *fo = QGuiApplication::focusObject(); if (!fo) - return selRange; + return selectedRange; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); if (!QCoreApplication::sendEvent(fo, &queryEvent)) - return selRange; + return selectedRange; if (!queryEvent.value(Qt::ImEnabled).toBool()) - return selRange; + return selectedRange; QString selectedText = queryEvent.value(Qt::ImCurrentSelection).toString(); if (!selectedText.isEmpty()) { - selRange.location = 0; - selRange.length = selectedText.length(); + selectedRange.location = 0; + selectedRange.length = selectedText.length(); } - return selRange; + return selectedRange; } -- (NSRect) firstRectForCharacterRange:(NSRange)theRange +- (NSRect) firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { - Q_UNUSED(theRange); + Q_UNUSED(aRange) + Q_UNUSED(actualRange) QObject *fo = QGuiApplication::focusObject(); if (!fo) return NSZeroRect; @@ -884,10 +882,10 @@ static QTouchDevice *touchDevice = 0; return rect; } -- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint +- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint { // We dont support cursor movements using mouse while composing. - Q_UNUSED(thePoint); + Q_UNUSED(aPoint); return NSNotFound; } -- cgit v1.2.3