From 8cc3a10721bc56e54b61aea861b04d7fd6b67e9a Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Mon, 17 Feb 2020 08:03:39 +0100 Subject: [PATCH] Ensuring that editor keeps focus when live preview is enabled #1214 --- app/src/qt/note_editor_view.cpp | 6 +++--- app/src/qt/orloj_presenter.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/qt/note_editor_view.cpp b/app/src/qt/note_editor_view.cpp index 0ff7bb94..764195ee 100644 --- a/app/src/qt/note_editor_view.cpp +++ b/app/src/qt/note_editor_view.cpp @@ -566,8 +566,8 @@ void NoteEditorView::lineNumberPanelPaintEvent(QPaintEvent* event) QTextBlock block = firstVisibleBlock(); int blockNumber = block.blockNumber(); - int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + (int) blockBoundingRect(block).height(); + int top = static_cast(blockBoundingGeometry(block).translated(contentOffset()).top()); + int bottom = top + static_cast(blockBoundingRect(block).height()); int currentLine = textCursor().blockNumber(); while(block.isValid() && top <= event->rect().bottom()) { @@ -583,7 +583,7 @@ void NoteEditorView::lineNumberPanelPaintEvent(QPaintEvent* event) block = block.next(); top = bottom; - bottom = top + (int)blockBoundingRect(block).height(); + bottom = top + static_cast(blockBoundingRect(block).height()); ++blockNumber; } } diff --git a/app/src/qt/orloj_presenter.cpp b/app/src/qt/orloj_presenter.cpp index 53d04d67..f6f7344c 100644 --- a/app/src/qt/orloj_presenter.cpp +++ b/app/src/qt/orloj_presenter.cpp @@ -817,8 +817,14 @@ void OrlojPresenter::slotRefreshCurrentNotePreview() { if(!config.isUiHoistedMode()) { if(isFacetActive(OrlojPresenterFacets::FACET_EDIT_NOTE)) { noteViewPresenter->refreshCurrent(); +#if defined(__APPLE__) || defined(_WIN32) + getNoteEdit()->getView()->getNoteEditor()->setFocus(); +#endif } else if(isFacetActive(OrlojPresenterFacets::FACET_EDIT_OUTLINE_HEADER)) { outlineHeaderViewPresenter->refreshCurrent(); +#if defined(__APPLE__) || defined(_WIN32) + getOutlineHeaderEdit()->getView()->getHeaderEditor()->setFocus(); +#endif } } }