1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <QtInstanceScale.hxx>
11 #include <QtInstanceScale.moc>
13 QtInstanceScale::QtInstanceScale(QSlider
* pSlider
)
14 : QtInstanceWidget(pSlider
)
18 connect(m_pSlider
, &QSlider::valueChanged
, this, &QtInstanceScale::handleValueChanged
);
21 void QtInstanceScale::set_value(int nValue
)
25 GetQtInstance().RunInMainThread([&] { m_pSlider
->setValue(nValue
); });
28 int QtInstanceScale::get_value() const
33 GetQtInstance().RunInMainThread([&] { nValue
= m_pSlider
->value(); });
38 void QtInstanceScale::set_range(int nMin
, int nMax
)
42 GetQtInstance().RunInMainThread([&] {
43 m_pSlider
->setMinimum(nMin
);
44 m_pSlider
->setMaximum(nMax
);
48 void QtInstanceScale::set_increments(int nStep
, int nPage
)
52 GetQtInstance().RunInMainThread([&] {
53 m_pSlider
->setSingleStep(nStep
);
54 m_pSlider
->setPageStep(nPage
);
57 void QtInstanceScale::get_increments(int& rStep
, int& rPage
) const
61 GetQtInstance().RunInMainThread([&] {
62 rStep
= m_pSlider
->singleStep();
63 rPage
= m_pSlider
->pageStep();
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: */