summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@nokia.com>2012-03-31 23:22:05 +0900
committerQt by Nokia <qt-info@nokia.com>2012-04-18 01:33:57 +0200
commitf5c3226f587553d2af1d2ef273d653e226c914b9 (patch)
tree2264e1dbd594de9433d8cc27d0a44298317e76a5 /src/plugins
parent7bab41a68116fe70b5f2ddb5d03f6fa0db25a01a (diff)
change NSTextInput to NSTextInputClient in Cocoa plugin
NSTextInput protocol is slated for deprecation Task-number: QTBUG-23867 Change-Id: I3f9eadc31bdf4234c63f1bcde5172f22da8d340e Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h2
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm46
2 files changed, 23 insertions, 25 deletions
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 <NSTextInput> {
+@interface QNSView : NSView <NSTextInputClient> {
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<QInputMethodEvent::Attribute> attrs;
- attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, selRange.location + selRange.length, 1, QVariant());
+ attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, selectedRange.location + selectedRange.length, 1, QVariant());
if ([aString isKindOfClass:[NSAttributedString class]]) {
// Preedit string has attribution
@@ -793,13 +795,9 @@ static QTouchDevice *touchDevice = 0;
return (m_composingText.isEmpty() ? NO: YES);
}
-- (NSInteger) conversationIdentifier
-{
- return (NSInteger)self;
-}
-
-- (NSAttributedString *) attributedSubstringFromRange:(NSRange)theRange
+- (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{
+ Q_UNUSED(actualRange)
QObject *fo = QGuiApplication::focusObject();
if (!fo)
return nil;
@@ -813,7 +811,7 @@ static QTouchDevice *touchDevice = 0;
if (selectedText.isEmpty())
return nil;
- QCFString string(selectedText.mid(theRange.location, theRange.length));
+ QCFString string(selectedText.mid(aRange.location, aRange.length));
const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
return [[[NSAttributedString alloc] initWithString:const_cast<NSString *>(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;
}