Skip to content

[BUG] Japanese IME Candidate Window overlaps text when typing.(Windows) #3590

@kurogk

Description

@kurogk

Expected behaviour

When inputting Japanese, the IME candidate window does not overlap with the text.

Actual behaviour

The IME candidate window overlaps by almost half, making it difficult to see the text being input.

Steps to reproduce

Steps to reproduce the behavior:

  1. Open the edit screen
  2. Enable the Japanese IME
  3. Start inputting

Screenshots

QOwnNotes_IME.BEFORE.mp4

Workaround

I added ViewportMargins to QRectF of CursorQuery, thinking that ViewportMargins might not be reflected.

QOwnNotes_IME.CANDIDATE.mp4

Workaround code:

QVariant QOwnNotesMarkdownTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const {
    QVariant result = QPlainTextEdit::inputMethodQuery(property);
    const bool isCursorQuery = (property == Qt::ImCursorRectangle || property == Qt::ImAnchorRectangle);
    if (isCursorQuery) {
        const QMargins vm = viewportMargins();
        const QPoint offset(vm.left(), vm.top());
        if (!offset.isNull()) {
            if (result.userType() == QMetaType::QRectF) {
                QRectF rect = result.toRectF().translated(0, qreal(offset.y()));
                result = rect;
            }
        }
    }

    return result;
}

Probably only in Qt for Windows environments.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions