vcl/qt5/QtInstanceScrolledWindow.cxx |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 3f776f44d704e1c2786d461fe06aa9335192c1df
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Dec 21 01:37:28 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Dec 21 09:33:02 2024 +0100

    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.wegh...@posteo.de>
    Tested-by: Jenkins

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&)
 {

Reply via email to