平滑滚动 QTableWidget

Scrolling QTableWidget smoothly

我有一个带有自定义小部件的 QTableWidget。这些小部件很大,几乎填满了整个滚动区域的高度,因此只有一行是可见的。

我可以用鼠标滚轮或拖动滚动条滚动,但行总是跳动。

有没有办法让QTableWidget平滑滚动,不跳转?

尝试使用这个:

view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel)

来自 Qt 文档:

enum ScrollMode { ScrollPerItem, ScrollPerPixel }

verticalScrollMode : ScrollMode

This property holds how the view scrolls its contents in the vertical direction.

This property controls how the view scroll its contents vertically. Scrolling can be done either per pixel or per item.