Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions liteidex/src/plugins/liteeditor/liteeditorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,19 @@ void LiteEditorWidget::inputMethodEvent(QInputMethodEvent *e)
LiteEditorWidgetBase::inputMethodEvent(e);
}

QVariant LiteEditorWidget::inputMethodQuery(Qt::InputMethodQuery query) const
{
// Qt 6 QWidgetTextControl::inputMethodQuery calls deleteLater() on the
// QMimeData from createMimeDataFromSelection(), which returns null when
// nothing is selected. macOS accessibility/Services queries this and crashes.
if (query == Qt::ImCurrentSelection) {
if (m_inBlockSelectionMode)
return copyBlockSelection();
return textCursor().selectedText();
}
return LiteEditorWidgetBase::inputMethodQuery(query);
}

static void convertToPlainText(QString &txt)
{
QChar *uc = txt.data();
Expand Down
1 change: 1 addition & 0 deletions liteidex/src/plugins/liteeditor/liteeditorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class LiteEditorWidget : public LiteEditorWidgetBase
void contextMenuEvent(QContextMenuEvent *);
void keyPressEvent(QKeyEvent *e);
void inputMethodEvent(QInputMethodEvent * e);
QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
void focusInEvent(QFocusEvent *e);
void wheelEvent(QWheelEvent *e);
virtual QMimeData *createMimeDataFromSelection() const;
Expand Down
Loading