File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# QOwnNotes Changelog
22
3+ ## 26.5.1
4+
5+ - Fixed IME candidate window overlapping text when typing with a Japanese (or
6+ other CJK) IME on Windows by overriding `inputMethodQuery()` in
7+ `QOwnNotesMarkdownTextEdit` to offset the reported cursor rectangle by the
8+ current viewport margins (for [#3590](https://github.com/pbek/QOwnNotes/issues/3590))
9+
310## 26.5.0
411
512- Added **Note Bookmarks** sub-menus to the _Note / Navigation_ menu
Original file line number Diff line number Diff line change @@ -3438,6 +3438,30 @@ void QOwnNotesMarkdownTextEdit::focusInEvent(QFocusEvent *e) {
34383438 QMarkdownTextEdit::focusInEvent (e);
34393439}
34403440
3441+ /* *
3442+ * Override inputMethodQuery to fix IME candidate window position on Windows.
3443+ * When viewport margins are set (e.g. for paper margins), the cursor rectangle
3444+ * returned to the IME must be offset by the top/left margin so that the
3445+ * candidate window appears adjacent to the cursor rather than overlapping it.
3446+ */
3447+ QVariant QOwnNotesMarkdownTextEdit::inputMethodQuery (Qt::InputMethodQuery property) const {
3448+ QVariant result = QPlainTextEdit::inputMethodQuery (property);
3449+
3450+ const bool isCursorQuery =
3451+ (property == Qt::ImCursorRectangle || property == Qt::ImAnchorRectangle);
3452+ if (isCursorQuery) {
3453+ // viewportMargins() is non-const in this class, so cast away const to call it
3454+ const QMargins vm = const_cast <QOwnNotesMarkdownTextEdit *>(this )->viewportMargins ();
3455+ if (vm.top () != 0 || vm.left () != 0 ) {
3456+ if (result.userType () == QMetaType::QRectF) {
3457+ result = result.toRectF ().translated (qreal (vm.left ()), qreal (vm.top ()));
3458+ }
3459+ }
3460+ }
3461+
3462+ return result;
3463+ }
3464+
34413465/* *
34423466 * Register this editor as the active one for AI autocomplete
34433467 */
Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ class QOwnNotesMarkdownTextEdit : public QMarkdownTextEdit {
162162 int sidebarAdditionalWidth () const override ;
163163 void paintSidebar (QPainter *painter, const QRect &eventRect) override ;
164164 bool sidebarMousePressEvent (QMouseEvent *event) override ;
165+ QVariant inputMethodQuery (Qt::InputMethodQuery property) const override ;
165166
166167 private:
167168 struct FoldRegion {
You can’t perform that action at this time.
0 commit comments