Hi, thanks you for answer.
The scroll area in my application is inside another widget, the main window, and it has an illustrated background. The problem is for main window not the content of the scroll area.
Anyway, I found a workaround, I set the same background for the main window and the scroll bar, so the scroll bar is opaque but looks transparent.
I still wonder why is there this strange behaviour with the scroll bar, but this topic can be considered as solved as I found a way to get around this.
Thanks but I asked same question on StackOverflow
https://stackoverflow.com/questions/55471486/how-can-i-set-maximum-width-to-which-qscrollarea-within-qdialog-will-expand-wi/
The reason of such behaviour is cause QScrollArea::sizeHint() has boundedTo(QSize(36 * h, 24 * h)) , where h is fontMetrics().height(), at the end of implementation. So reimplementing sizeHint() is doing the job just fine
Hi
If you look here
https://code.woboq.org/qt5/qtbase/src/widgets/styles/qwindowsstyle.cpp.html
in 1894
void QWindowsStyle::drawComplexControl
you can see the use of
QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
I assume you can get the various parts this way, even you changed it using stylesheet.
AFAIK, the Qt 4.8 series has no release officially supporting such a recent version of macOS. Therefore you may have surprises. Note that Qt 4 has reached end of life so unless you are locked to that version, you should really consider updating to Qt 5 which is now at it's 5.9.0 release.
hi
I have never tried this myself so might be silly question,
If you set the qtableview to always show horz scrollbar (Qt::ScrollBarPolicy)
and then replace it with your own. the size should fit?
Or is because your new scrollbar is bigger? (than the std one)
the docs says
"When a scroll bar becomes visible again, the viewport shrinks in order to make room for the scroll bar."
so it should just work by auto. So I wonder if the custom bar dont give correct size info?