Revert "QAIV - Fix scollbars with ScrollPerPixel to scroll 1 pixel."
This reverts commit 934f062203
.
The patch needs to be modified a bit. Many users considers
not having the old feature as a big regression.
The feature needs to be improved with a variable that is
only set when the user uses setSingleStep.
Task-number: QTBUG-33906
Change-Id: I35e5d3e9d3d7a3ebd01807b03a0e7a424185d483
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
7fab8eb56b
commit
0e69230d02
@ -1837,18 +1837,18 @@ void QCommonListViewBase::paintDragDrop(QPainter *painter)
|
||||
}
|
||||
#endif
|
||||
|
||||
void QCommonListViewBase::updateHorizontalScrollBar(const QSize & /*step*/)
|
||||
void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
|
||||
{
|
||||
horizontalScrollBar()->setSingleStep(step.width() + spacing());
|
||||
horizontalScrollBar()->setPageStep(viewport()->width());
|
||||
horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width());
|
||||
// we do not want to overwrite (a possible user set) single step
|
||||
}
|
||||
|
||||
void QCommonListViewBase::updateVerticalScrollBar(const QSize & /*step*/)
|
||||
void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
|
||||
{
|
||||
verticalScrollBar()->setSingleStep(step.height() + spacing());
|
||||
verticalScrollBar()->setPageStep(viewport()->height());
|
||||
verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height());
|
||||
// we do not want to overwrite (a possible user set) single step
|
||||
}
|
||||
|
||||
void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/)
|
||||
|
@ -2170,7 +2170,7 @@ void QTableView::updateGeometries()
|
||||
} else { // ScrollPerPixel
|
||||
horizontalScrollBar()->setPageStep(vsize.width());
|
||||
horizontalScrollBar()->setRange(0, horizontalLength - vsize.width());
|
||||
// here we do not want to overwrite (a possible user set) single step
|
||||
horizontalScrollBar()->setSingleStep(qMax(vsize.width() / (columnsInViewport + 1), 2));
|
||||
}
|
||||
|
||||
// vertical scroll bar
|
||||
@ -2198,7 +2198,7 @@ void QTableView::updateGeometries()
|
||||
} else { // ScrollPerPixel
|
||||
verticalScrollBar()->setPageStep(vsize.height());
|
||||
verticalScrollBar()->setRange(0, verticalLength - vsize.height());
|
||||
// here we do not want to overwrite (a possible user set) single step
|
||||
verticalScrollBar()->setSingleStep(qMax(vsize.height() / (rowsInViewport + 1), 2));
|
||||
}
|
||||
|
||||
d->geometryRecursionBlock = false;
|
||||
|
@ -3685,7 +3685,7 @@ void QTreeViewPrivate::updateScrollBars()
|
||||
}
|
||||
vbar->setRange(0, contentsHeight - viewportSize.height());
|
||||
vbar->setPageStep(viewportSize.height());
|
||||
// here we do not want to overwrite (a possible user set) single step
|
||||
vbar->setSingleStep(qMax(viewportSize.height() / (itemsInViewport + 1), 2));
|
||||
}
|
||||
|
||||
const int columnCount = header->count();
|
||||
@ -3711,7 +3711,7 @@ void QTreeViewPrivate::updateScrollBars()
|
||||
viewportSize = maxSize;
|
||||
hbar->setPageStep(viewportSize.width());
|
||||
hbar->setRange(0, qMax(horizontalLength - viewportSize.width(), 0));
|
||||
// here we do not want to overwrite (a possible user set) single step
|
||||
hbar->setSingleStep(qMax(viewportSize.width() / (columnsInViewport + 1), 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3702,7 +3702,7 @@ void tst_QTableView::mouseWheel_data()
|
||||
<< 10 + qApp->wheelScrollLines() << 10 + qApp->wheelScrollLines();
|
||||
QTest::newRow("scroll down per pixel")
|
||||
<< int(QAbstractItemView::ScrollPerPixel) << -120
|
||||
<< 10 + qApp->wheelScrollLines() << 10 + qApp->wheelScrollLines();
|
||||
<< 10 + qApp->wheelScrollLines() * 89 << 10 + qApp->wheelScrollLines() * 28;
|
||||
}
|
||||
|
||||
void tst_QTableView::mouseWheel()
|
||||
|
Loading…
Reference in New Issue
Block a user