Skip to content

Commit

Permalink
Ensuring that editor keeps focus when live preview is enabled #1214
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorka committed Feb 17, 2020
1 parent 48c9ab3 commit 8cc3a10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/qt/note_editor_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(blockBoundingGeometry(block).translated(contentOffset()).top());
int bottom = top + static_cast<int>(blockBoundingRect(block).height());

int currentLine = textCursor().blockNumber();
while(block.isValid() && top <= event->rect().bottom()) {
Expand All @@ -583,7 +583,7 @@ void NoteEditorView::lineNumberPanelPaintEvent(QPaintEvent* event)

block = block.next();
top = bottom;
bottom = top + (int)blockBoundingRect(block).height();
bottom = top + static_cast<int>(blockBoundingRect(block).height());
++blockNumber;
}
}
Expand Down
6 changes: 6 additions & 0 deletions app/src/qt/orloj_presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit 8cc3a10

Please sign in to comment.