summaryrefslogtreecommitdiff
path: root/vcl/qt5/QtInstanceScrolledWindow.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/qt5/QtInstanceScrolledWindow.cxx')
-rw-r--r--vcl/qt5/QtInstanceScrolledWindow.cxx64
1 files changed, 56 insertions, 8 deletions
diff --git a/vcl/qt5/QtInstanceScrolledWindow.cxx b/vcl/qt5/QtInstanceScrolledWindow.cxx
index da71b13fa73b..fd4f6f0a65ee 100644
--- a/vcl/qt5/QtInstanceScrolledWindow.cxx
+++ b/vcl/qt5/QtInstanceScrolledWindow.cxx
@@ -80,15 +80,23 @@ void QtInstanceScrolledWindow::hadjustment_set_step_increment(int)
assert(false && "Not implemented yet");
}
-void QtInstanceScrolledWindow::set_hpolicy(VclPolicyType)
+void QtInstanceScrolledWindow::set_hpolicy(VclPolicyType eHPolicy)
{
- assert(false && "Not implemented yet");
+ SolarMutexGuard g;
+
+ GetQtInstance().RunInMainThread(
+ [&] { m_pScrollArea->setHorizontalScrollBarPolicy(toQtPolicy(eHPolicy)); });
}
VclPolicyType QtInstanceScrolledWindow::get_hpolicy() const
{
- assert(false && "Not implemented yet");
- return VclPolicyType::ALWAYS;
+ SolarMutexGuard g;
+
+ VclPolicyType ePolicy = VclPolicyType::AUTOMATIC;
+ GetQtInstance().RunInMainThread(
+ [&] { ePolicy = toVclPolicy(m_pScrollArea->horizontalScrollBarPolicy()); });
+
+ return ePolicy;
}
void QtInstanceScrolledWindow::vadjustment_configure(int, int, int, int, int, int)
@@ -155,15 +163,23 @@ void QtInstanceScrolledWindow::vadjustment_set_lower(int)
assert(false && "Not implemented yet");
}
-void QtInstanceScrolledWindow::set_vpolicy(VclPolicyType)
+void QtInstanceScrolledWindow::set_vpolicy(VclPolicyType eVPolicy)
{
- assert(false && "Not implemented yet");
+ SolarMutexGuard g;
+
+ GetQtInstance().RunInMainThread(
+ [&] { m_pScrollArea->setVerticalScrollBarPolicy(toQtPolicy(eVPolicy)); });
}
VclPolicyType QtInstanceScrolledWindow::get_vpolicy() const
{
- assert(false && "Not implemented yet");
- return VclPolicyType::ALWAYS;
+ SolarMutexGuard g;
+
+ VclPolicyType ePolicy = VclPolicyType::AUTOMATIC;
+ GetQtInstance().RunInMainThread(
+ [&] { ePolicy = toVclPolicy(m_pScrollArea->verticalScrollBarPolicy()); });
+
+ return ePolicy;
}
int QtInstanceScrolledWindow::get_scroll_thickness() const
@@ -179,4 +195,36 @@ void QtInstanceScrolledWindow::customize_scrollbars(const Color&, const Color&,
assert(false && "Not implemented yet");
}
+Qt::ScrollBarPolicy QtInstanceScrolledWindow::toQtPolicy(VclPolicyType eVclPolicy)
+{
+ switch (eVclPolicy)
+ {
+ case VclPolicyType::ALWAYS:
+ return Qt::ScrollBarAlwaysOn;
+ case VclPolicyType::AUTOMATIC:
+ return Qt::ScrollBarAsNeeded;
+ case VclPolicyType::NEVER:
+ return Qt::ScrollBarAlwaysOff;
+ default:
+ assert(false && "Unhandled scroll bar policy");
+ return Qt::ScrollBarAsNeeded;
+ }
+}
+
+VclPolicyType QtInstanceScrolledWindow::toVclPolicy(Qt::ScrollBarPolicy eQtPolicy)
+{
+ switch (eQtPolicy)
+ {
+ case Qt::ScrollBarAlwaysOn:
+ return VclPolicyType::ALWAYS;
+ case Qt::ScrollBarAsNeeded:
+ return VclPolicyType::AUTOMATIC;
+ case Qt::ScrollBarAlwaysOff:
+ return VclPolicyType::NEVER;
+ default:
+ assert(false && "Unhandled scroll bar policy");
+ return VclPolicyType::AUTOMATIC;
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */