Fix compilation after removing QEvent copy ctor

In 19f9b0d5f54379151eb71e98555b203ad6756276 in qtbase, the
copy constructors for QEvents were removed, so code using
this has to be updated.

Change-Id: I5798b240d79f78c47374d60947b1bc66598ff3b5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2020-11-19 08:12:37 +01:00
parent e1c5ff6e70
commit 0936d81b79
3 changed files with 14 additions and 12 deletions

View File

@ -269,12 +269,13 @@ void QWaylandTextInput::zwp_text_input_v2_preedit_string(const QString &text, co
if (!QGuiApplication::focusObject())
return;
QInputMethodEvent event = m_builder.buildPreedit(text);
QInputMethodEvent *event = m_builder.buildPreedit(text);
m_builder.reset();
m_preeditCommit = commit;
QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
QCoreApplication::sendEvent(QGuiApplication::focusObject(), event);
delete event;
}
void QWaylandTextInput::zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style)
@ -298,11 +299,12 @@ void QWaylandTextInput::zwp_text_input_v2_commit_string(const QString &text)
if (!QGuiApplication::focusObject())
return;
QInputMethodEvent event = m_builder.buildCommit(text);
QInputMethodEvent *event = m_builder.buildCommit(text);
m_builder.reset();
QCoreApplication::sendEvent(QGuiApplication::focusObject(), &event);
QCoreApplication::sendEvent(QGuiApplication::focusObject(), event);
delete event;
}
void QWaylandTextInput::zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor)

View File

@ -117,7 +117,7 @@ void QWaylandInputMethodEventBuilder::setPreeditCursor(int32_t index)
m_preeditCursor = index;
}
QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &text)
QInputMethodEvent *QWaylandInputMethodEventBuilder::buildCommit(const QString &text)
{
QList<QInputMethodEvent::Attribute> attributes;
@ -141,13 +141,13 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildCommit(const QString &te
QVariant()));
}
QInputMethodEvent event(QString(), attributes);
event.setCommitString(text, replacement.first, replacement.second);
QInputMethodEvent *event = new QInputMethodEvent(QString(), attributes);
event->setCommitString(text, replacement.first, replacement.second);
return event;
}
QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &text)
QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString &text)
{
QList<QInputMethodEvent::Attribute> attributes;
@ -163,10 +163,10 @@ QInputMethodEvent QWaylandInputMethodEventBuilder::buildPreedit(const QString &t
attributes.append(QInputMethodEvent::Attribute(attr.type, start, length, attr.value));
}
QInputMethodEvent event(text, attributes);
QInputMethodEvent *event = new QInputMethodEvent(text, attributes);
const QPair<int, int> replacement = replacementForDeleteSurrounding();
event.setCommitString(QString(), replacement.first, replacement.second);
event->setCommitString(QString(), replacement.first, replacement.second);
return event;
}

View File

@ -58,8 +58,8 @@ public:
void addPreeditStyling(uint32_t index, uint32_t length, uint32_t style);
void setPreeditCursor(int32_t index);
QInputMethodEvent buildCommit(const QString &text);
QInputMethodEvent buildPreedit(const QString &text);
QInputMethodEvent *buildCommit(const QString &text);
QInputMethodEvent *buildPreedit(const QString &text);
static int indexFromWayland(const QString &text, int length, int base = 0);
static int indexToWayland(const QString &text, int length, int base = 0);