Scrolling QTableWidget smoothly

孤街浪徒 提交于 2019-12-08 08:52:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!