Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling QTableWidget smoothly

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?

like image 862
Sacha Guyer Avatar asked Oct 27 '25 16:10

Sacha Guyer


1 Answers

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.

like image 137
Evgeny Avatar answered Oct 29 '25 05:10

Evgeny