Mark some Calc slots as inactive in readonly mode
[LibreOffice.git] / vcl / qt5 / QtInstanceScale.cxx
blobfe5f832e3dba9a51d90626ea2a385024c1265070
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <QtInstanceScale.hxx>
11 #include <QtInstanceScale.moc>
13 QtInstanceScale::QtInstanceScale(QSlider* pSlider)
14 : QtInstanceWidget(pSlider)
15 , m_pSlider(pSlider)
17 assert(m_pSlider);
18 connect(m_pSlider, &QSlider::valueChanged, this, &QtInstanceScale::handleValueChanged);
21 void QtInstanceScale::set_value(int nValue)
23 SolarMutexGuard g;
25 GetQtInstance().RunInMainThread([&] { m_pSlider->setValue(nValue); });
28 int QtInstanceScale::get_value() const
30 SolarMutexGuard g;
32 int nValue;
33 GetQtInstance().RunInMainThread([&] { nValue = m_pSlider->value(); });
35 return nValue;
38 void QtInstanceScale::set_range(int nMin, int nMax)
40 SolarMutexGuard g;
42 GetQtInstance().RunInMainThread([&] {
43 m_pSlider->setMinimum(nMin);
44 m_pSlider->setMaximum(nMax);
45 });
48 void QtInstanceScale::set_increments(int nStep, int nPage)
50 SolarMutexGuard g;
52 GetQtInstance().RunInMainThread([&] {
53 m_pSlider->setSingleStep(nStep);
54 m_pSlider->setPageStep(nPage);
55 });
57 void QtInstanceScale::get_increments(int& rStep, int& rPage) const
59 SolarMutexGuard g;
61 GetQtInstance().RunInMainThread([&] {
62 rStep = m_pSlider->singleStep();
63 rPage = m_pSlider->pageStep();
64 });
67 void QtInstanceScale::handleValueChanged()
69 SolarMutexGuard aGuard;
70 signal_value_changed();
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */