PDA

View Full Version : QScrollArea border rendering problem



Annihilator
27th March 2012, 18:37
I'm rendering a border for a qscrollarea using stylesheets


QScrollArea#previews { border: 4px solid red; }
and

previewScrollArea->setObjectName("previews");

It works well until a scrollbar appears. When I click a scrollbar arrow to scroll content, the qscrollarea border does not render near scrollbar
7535
If I maximize an application window and resize it back then QScrollArea (probably) updates and border renders properly, but if I click a scrollbar arrow then I have the same problem again.

Thanks

Spitfire
28th March 2012, 16:47
This is because of the corner piece which is there if both scrollbars are present (border should be drawn correctly with both scrollbars visible or not).
Not sure how to fix that though.

Edit:
set background of the preview scroll area to the same color as border and that will fix this specific case, but when both scroll bars are visible then you'll get red (or whatever color you set) corner piece.

wysota
28th March 2012, 17:20
A possible solution would be apply the border only to the viewport of the scroll area. It wouldn't contain the scrollbars then nevertheless it seems a reasonable option.

Annihilator
3rd April 2012, 21:08
It could be that my explanation is a bit wrong.
I have this issue with a border not after two scrollbars appear, but after I click on the arrow of the horizontal scrollbar.
Anyway I decided to use

setFrameStyle(QFrame::StyledPanel);