summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 80c8bfc48b..2c9157c4ec 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1544,7 +1544,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1);
}
- QObject *fo = QGuiApplication::focusObject();
+ QObject *fo = m_platformWindow->window()->focusObject();
if (m_sendKeyEvent && fo) {
QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints);
if (QCoreApplication::sendEvent(fo, &queryEvent)) {
@@ -1694,8 +1694,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
commitString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString));
};
}
- QObject *fo = QGuiApplication::focusObject();
- if (fo) {
+ if (QObject *fo = m_platformWindow->window()->focusObject()) {
QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
if (QCoreApplication::sendEvent(fo, &queryEvent)) {
if (queryEvent.value(Qt::ImEnabled).toBool()) {
@@ -1762,8 +1761,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
m_composingText = preeditString;
- QObject *fo = QGuiApplication::focusObject();
- if (fo) {
+ if (QObject *fo = m_platformWindow->window()->focusObject()) {
QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
if (QCoreApplication::sendEvent(fo, &queryEvent)) {
if (queryEvent.value(Qt::ImEnabled).toBool()) {
@@ -1779,8 +1777,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (void) unmarkText
{
if (!m_composingText.isEmpty()) {
- QObject *fo = QGuiApplication::focusObject();
- if (fo) {
+ if (QObject *fo = m_platformWindow->window()->focusObject()) {
QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
if (QCoreApplication::sendEvent(fo, &queryEvent)) {
if (queryEvent.value(Qt::ImEnabled).toBool()) {
@@ -1802,7 +1799,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
- (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{
Q_UNUSED(actualRange)
- QObject *fo = QGuiApplication::focusObject();
+ QObject *fo = m_platformWindow->window()->focusObject();
if (!fo)
return nil;
QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection);
@@ -1837,7 +1834,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
{
NSRange selectedRange = {0, 0};
- QObject *fo = QGuiApplication::focusObject();
+ QObject *fo = m_platformWindow->window()->focusObject();
if (!fo)
return selectedRange;
QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection);
@@ -1859,7 +1856,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
{
Q_UNUSED(aRange)
Q_UNUSED(actualRange)
- QObject *fo = QGuiApplication::focusObject();
+ QObject *fo = m_platformWindow->window()->focusObject();
if (!fo)
return NSZeroRect;
@@ -1899,7 +1896,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
if (m_platformWindow->window() != QGuiApplication::focusWindow())
return nil;
- QObject *fo = QGuiApplication::focusObject();
+ QObject *fo = m_platformWindow->window()->focusObject();
if (!fo)
return nil;