diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-21 01:37:28 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-21 09:33:02 +0100 |
commit | 3f776f44d704e1c2786d461fe06aa9335192c1df (patch) | |
tree | 9f03cd226976ca4ccb69fa1a3ada82071e55e234 | |
parent | 71d90c236d57580e3e81adcd09ea5abe5be8a8d2 (diff) |
tdf#130857 qt weld: Implement {g,s}etting scroll bar thickness
Do it in a similar way as the GtkInstanceScrolledWindow
implementation.
Change-Id: I92d5b1d55ed390e012e59525dd9fc9e9ffc72cfb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178977
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
-rw-r--r-- | vcl/qt5/QtInstanceScrolledWindow.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vcl/qt5/QtInstanceScrolledWindow.cxx b/vcl/qt5/QtInstanceScrolledWindow.cxx index fd4f6f0a65ee..223eec9796ff 100644 --- a/vcl/qt5/QtInstanceScrolledWindow.cxx +++ b/vcl/qt5/QtInstanceScrolledWindow.cxx @@ -184,11 +184,30 @@ VclPolicyType QtInstanceScrolledWindow::get_vpolicy() const int QtInstanceScrolledWindow::get_scroll_thickness() const { - assert(false && "Not implemented yet"); - return 0; + SolarMutexGuard g; + + int nThickness = 0; + GetQtInstance().RunInMainThread([&] { + if (QScrollBar* pVerticalScrollBar = m_pScrollArea->verticalScrollBar()) + nThickness = pVerticalScrollBar->width(); + else if (QScrollBar* pHorizontalScrollBar = m_pScrollArea->horizontalScrollBar()) + nThickness = pHorizontalScrollBar->height(); + }); + + return nThickness; } -void QtInstanceScrolledWindow::set_scroll_thickness(int) { assert(false && "Not implemented yet"); } +void QtInstanceScrolledWindow::set_scroll_thickness(int nThickness) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + if (QScrollBar* pVerticalScrollBar = m_pScrollArea->verticalScrollBar()) + pVerticalScrollBar->resize(nThickness, pVerticalScrollBar->height()); + else if (QScrollBar* pHorizontalScrollBar = m_pScrollArea->horizontalScrollBar()) + pHorizontalScrollBar->resize(pHorizontalScrollBar->width(), nThickness); + }); +} void QtInstanceScrolledWindow::customize_scrollbars(const Color&, const Color&, const Color&) { |