Add implementation of QCocoaInputContext::commit()
Without this we end up treating input method commits from the input items as cancellations, as the base class implementation doesn't do anything. Pick-to: 6.2 Change-Id: Ieeed71404ee32ab51287b2f4f2d70ffcf9d8e7ef Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
c67f46877c
commit
0488fde042
|
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
void setFocusObject(QObject *object) override;
|
||||
|
||||
void commit() override;
|
||||
void reset() override;
|
||||
|
||||
QLocale locale() const override { return m_locale; }
|
||||
|
|
|
|||
|
|
@ -95,6 +95,33 @@ QCocoaInputContext::~QCocoaInputContext()
|
|||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Commits the current composition if there is one,
|
||||
by "unmarking" the text in the edit buffer, and
|
||||
informing the system input context of this fact.
|
||||
*/
|
||||
void QCocoaInputContext::commit()
|
||||
{
|
||||
qCDebug(lcQpaInputMethods) << "Committing composition";
|
||||
|
||||
if (!m_focusWindow)
|
||||
return;
|
||||
|
||||
auto *platformWindow = m_focusWindow->handle();
|
||||
if (!platformWindow)
|
||||
return;
|
||||
|
||||
auto *cocoaWindow = static_cast<QCocoaWindow *>(platformWindow);
|
||||
QNSView *view = qnsview_cast(cocoaWindow->view());
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
QMacAutoReleasePool pool;
|
||||
[view unmarkText];
|
||||
[view.inputContext discardMarkedText];
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Cancels a composition.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue