summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2014-01-13 14:29:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-14 12:59:09 +0100
commit0e69230d02813f0b7a050645fb7e443bd504ab6a (patch)
treeb2a5ad09fa2b56234821ad264a287f12b57ff639 /src
parent7fab8eb56b9309734d1b34d3d935d6a4cf14ce6e (diff)
Revert "QAIV - Fix scollbars with ScrollPerPixel to scroll 1 pixel."
This reverts commit 934f06220391eb0e0ebf66a2eb037f48adb4c43c. 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>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/itemviews/qlistview.cpp8
-rw-r--r--src/widgets/itemviews/qtableview.cpp4
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 0cca52daa2..7f7c60b10e 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -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*/)
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 08600b3ef7..a252428a81 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -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;
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 4d0eb5c3ad..5d0e835b0e 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -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));
}
}