问题
I have a QTableWidget with custom Widgets. These widgets are big and fill almost the whole scroll area in height, so that only one row is visible.
I can scroll with the mouse wheel or by dragging the scroll bar, but the row always jumps.
Is there a way to configure the QTableWidget to smoothly scroll, without jumping?
回答1:
Try to use this:
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel)
From Qt documentation:
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.
来源:https://stackoverflow.com/questions/34719037/scrolling-qtablewidget-smoothly