Skip to content

KConfigDialog: Try to avoid horizontal scrollbars

The QScrollArea, wich is used for wrapping pages, does not include scrollbars in its sizeHint(). This checks whether the QScrollArea uses the page’s horizontal size and a smaller vertical size as size hint, and in that case sets the minimum horizontal size to include the vertical scrollbar.

I use the scrollbar’s size hint and add a safety margin of 2px and 4px to avoid frustration in case rounding differs in the future.

The worst case which I expect is that the window is 204 device independent pixels wider than expected and the page widget distributes the additional space to the controls.

Screenshot:

kconfigdialog_size

(before/after)

This annoyed me often in Okular. I don’t know of any other application which actually has this problem.

Merge request reports