diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2020-11-19 11:51:13 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2020-11-19 18:11:05 +0100 |
commit | f39f21d92ec83c3a5062f29dd26214fc83012c06 (patch) | |
tree | a1d6dc2de67cf99ce80d1a1e3f64145f8d403e20 /include | |
parent | 411063bc99f7339afae2c2a25a146c7c5efeb2da (diff) |
tdf#138010 (IV) VclScrolledWindow: Use actual border width
The frame drawn by 'DecorationView::DrawFrame' may
use native drawing, in which case the frame may be wider
than 1 pixel.
Take that into account and calculate the frame width
and resulting position/size of the scrollbars and
child widget using the content rectangle returned when
drawing the frame using 'DecorationView::DrawFrame'.
This avoids that the child widget is drawn on top
of the frame, which e.g. resulted in no visible border
when using the Qt/KDE Breeze style, which has a frame
width of 2, with the actual 1 pixel border being
surrounded by a 1 pixel padding/margin, and the content
being drawn on top of the 1 pixel border. With the
child widget being drawn on top of the actual border,
only the invisible padding was left where a visible
border was expected.
(The current implementation assumes that the same frame
width is used on all sides, which matches the
way Qt styles handle it, but could be further extended
if necessary.)
Change-Id: I44268728838406fc578774c0f4fcc167fb2798b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106157
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/layout.hxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index 9824078fa612..cea55a78755e 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -519,11 +519,13 @@ public: private: virtual Size calculateRequisition() const override; virtual void setAllocation(const Size &rAllocation) override; + // sets new border size and adapts scrollbar and child widget position/size as needed + void updateBorderWidth(tools::Long nBorderWidth); DECL_LINK(ScrollBarHdl, ScrollBar*, void); void InitScrollBars(const Size &rRequest); virtual bool EventNotify(NotifyEvent& rNEvt) override; bool m_bUserManagedScrolling; - const static tools::Long m_nBorderWidth; + tools::Long m_nBorderWidth; DrawFrameStyle m_eDrawFrameStyle; DrawFrameFlags m_eDrawFrameFlags; VclPtr<ScrollBar> m_pVScroll; |