Issue #142: Cannot reach the top

This commit is contained in:
Jakub Melka
2024-01-05 19:57:45 +01:00
parent ca698156cd
commit 843c025010
2 changed files with 9 additions and 2 deletions

View File

@ -645,10 +645,16 @@ void PDFDrawWidgetBase<BaseWidget>::wheelEvent(QWheelEvent* event)
// We must move to another block (we are in block mode) // We must move to another block (we are in block mode)
bool up = scrollByPixels.y() > 0; bool up = scrollByPixels.y() > 0;
m_widget->getVerticalScrollbar()->setValue(m_widget->getVerticalScrollbar()->value() + (up ? -1 : 1)); QScrollBar* verticalScrollbar = m_widget->getVerticalScrollbar();
const int newValue = verticalScrollbar->value() + (up ? -1 : 1);
if (newValue >= verticalScrollbar->minimum() && newValue <= verticalScrollbar->maximum())
{
verticalScrollbar->setValue(newValue);
proxy->scrollByPixels(QPoint(0, up ? std::numeric_limits<int>::min() : std::numeric_limits<int>::max())); proxy->scrollByPixels(QPoint(0, up ? std::numeric_limits<int>::min() : std::numeric_limits<int>::max()));
} }
} }
}
event->accept(); event->accept();
} }

View File

@ -1,4 +1,5 @@
CURRENT: CURRENT:
- Issue #142: Cannot reach the top
- Issue #141: Save button in toolbar - Issue #141: Save button in toolbar
- Issue #140: New bookmarks created empty? - Issue #140: New bookmarks created empty?
- Issue #139: Changing page layout reset the current page - Issue #139: Changing page layout reset the current page