Skip to content

Commit

Permalink
Fixed cursor problems
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLazarescu committed Sep 26, 2023
1 parent 788b312 commit 23ce361
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 180 deletions.
2 changes: 1 addition & 1 deletion src/adapters/controllers/dictionary_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void DictionaryController::processDefinition(bool success,
// with an uppercase letter after a period, but the dictionary API is
// case-sensitive so we change it to lowercase by default. This can
// cause problems for names or different languages though.
if(!m_searchedForWord[0].isUpper())
if(!m_searchedForWord.isEmpty() && !m_searchedForWord[0].isUpper())
{
auto capitalizedWord =
m_searchedForWord[0].toUpper() + m_searchedForWord.mid(1);
Expand Down
5 changes: 5 additions & 0 deletions src/presentation/modules/CppElements/page_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ void PageView::keyPressEvent(QKeyEvent* event)
}
}

void PageView::hoverLeaveEvent(QHoverEvent* event)
{
resetCursorToDefault();
}

void PageView::paintSelectionOnPage(QPainter& painter)
{
auto& selectionRects = m_pageController->getBufferedSelectionRects();
Expand Down
1 change: 1 addition & 0 deletions src/presentation/modules/CppElements/page_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private slots:
virtual void mouseMoveEvent(QMouseEvent* event) override;
virtual void hoverMoveEvent(QHoverEvent* event) override;
virtual void keyPressEvent(QKeyEvent* event) override;
virtual void hoverLeaveEvent(QHoverEvent* event) override;

private:
void selectSingleWord();
Expand Down
Loading

0 comments on commit 23ce361

Please sign in to comment.