QTableWidget滚动条滚动过快的一个原因

做了一个QTableWidget的数据展示,发现滚动过快,原来是这个原因:

enum QAbstractItemView::ScrollMode

Describes how the scrollbar should behave. When setting the scroll mode to ScrollPerPixel the single step size will adjust automatically unless it was set explicitly using setSingleStep(). The automatic adjustment can be restored by setting the single step size to -1.

Constant

Value

Description

QAbstractItemView::ScrollPerItem

0

The view will scroll the contents one item at a time.

QAbstractItemView::ScrollPerPixel

1

The view will scroll the contents one pixel at a time.

设置为按像素滚动即可。

相关文章: