1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

AutoScroll: Only scroll in the indicated direction

It's possible that the horizontal/vertical scrollbar is hidden, but
the page can still be scrolled in that direction.
This commit is contained in:
David Rosca 2017-01-27 11:10:09 +01:00
parent 0ad0a587eb
commit a9f9056d84
2 changed files with 13 additions and 0 deletions

View File

@ -34,6 +34,11 @@ ScrollIndicator::ScrollIndicator(QWidget *parent)
setContentsMargins(0, 0, 0, 0);
}
Qt::Orientations ScrollIndicator::orientations() const
{
return m_orientations;
}
void ScrollIndicator::setOrientations(Qt::Orientations orientations)
{
m_orientations = orientations;
@ -118,6 +123,13 @@ bool AutoScroller::mouseMove(QObject* obj, QMouseEvent* event)
ylength = event->globalPos().y() - rect.bottom();
}
if (!m_indicator->orientations().testFlag(Qt::Vertical)) {
ylength = 0;
}
if (!m_indicator->orientations().testFlag(Qt::Horizontal)) {
xlength = 0;
}
m_frameScroller->startScrolling(xlength, ylength);
}

View File

@ -33,6 +33,7 @@ class ScrollIndicator : public QLabel
public:
explicit ScrollIndicator(QWidget *parent = nullptr);
Qt::Orientations orientations() const;
void setOrientations(Qt::Orientations orientations);
private: