...by knowing how many item one wants to show and how much space eachJust check if the scrollbar should be visible at all.
of them will use up and how much space there is available, I presume.
Qt doesn't seem to know [whether a scrollbar is needed] by the time sizeHint is called;
The scrollbar width() always returns 100 there, it changes into 16 once it is actually rendered on screen.
I don't know is such assumptions are appropriate. Calling verticalScrollBar()->isVisible() might be more reliable.
That doesn't matter. You can change the size hint once the widget is rendered for the first time using QWidget::updateGeometry().Qt doesn't seem to know [whether a scrollbar is needed] by the time sizeHint is called;
Yes, that's normal for every widget.The scrollbar width() always returns 100 there, it changes into 16 once it is actually rendered on screen.
drhex (1st October 2006)
Just found a way to get the size of the scrollbar without having to display one first![]()
Qt Code:
To copy to clipboard, switch view to plain text mode
Bookmarks