mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +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:
parent
0ad0a587eb
commit
a9f9056d84
@ -34,6 +34,11 @@ ScrollIndicator::ScrollIndicator(QWidget *parent)
|
|||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Qt::Orientations ScrollIndicator::orientations() const
|
||||||
|
{
|
||||||
|
return m_orientations;
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollIndicator::setOrientations(Qt::Orientations orientations)
|
void ScrollIndicator::setOrientations(Qt::Orientations orientations)
|
||||||
{
|
{
|
||||||
m_orientations = orientations;
|
m_orientations = orientations;
|
||||||
@ -118,6 +123,13 @@ bool AutoScroller::mouseMove(QObject* obj, QMouseEvent* event)
|
|||||||
ylength = event->globalPos().y() - rect.bottom();
|
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);
|
m_frameScroller->startScrolling(xlength, ylength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class ScrollIndicator : public QLabel
|
|||||||
public:
|
public:
|
||||||
explicit ScrollIndicator(QWidget *parent = nullptr);
|
explicit ScrollIndicator(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
Qt::Orientations orientations() const;
|
||||||
void setOrientations(Qt::Orientations orientations);
|
void setOrientations(Qt::Orientations orientations);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user