PDA

View Full Version : QScrollArea - Scrollbar height reported wrong?



xdn
5th November 2015, 16:10
Hi all,

I have a widget in a QScrollArea which has a fixed default height of, say, 200px (set using setMinium/MaximumHeight(200) in its constructor).
The scrollarea has a horizontal scrollbar which is set to always show.
Now I want to set the height of the scrollarea so that the inner widget's bottom lines up exactly with the top of the hor. scrollbar (so no vertical scrollbar shows, hiding vert. scrollbar is no solution in my case).
I tried something like

myscrollarea->setMinimumHeight(mywidget->height()+myscrollarea->horizontalScrollBar()->height())
but this makes the scrollarea too high. Trial and error shows me that 18px would be the correct addition to mywidget->height(). myscrollarea->horizontalScrollBar()->height() reports a wrong height of 30px.
Does anyone know how this happens?

Thanks,
xdn