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 <QtInstanceCheckButton.hxx>
11 #include <QtInstanceCheckButton.moc>
13 #include <vcl/qt/QtUtils.hxx>
15 QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox
* pCheckBox
)
16 : QtInstanceWidget(pCheckBox
)
17 , m_pCheckBox(pCheckBox
)
20 connect(m_pCheckBox
, &QCheckBox::toggled
, this, &QtInstanceCheckButton::handleToggled
);
23 void QtInstanceCheckButton::set_active(bool bActive
)
26 GetQtInstance().RunInMainThread([&] {
27 m_pCheckBox
->setTristate(false);
28 m_pCheckBox
->setChecked(bActive
);
32 bool QtInstanceCheckButton::get_active() const
36 GetQtInstance().RunInMainThread([&] { bActive
= m_pCheckBox
->isChecked(); });
40 void QtInstanceCheckButton::set_inconsistent(bool bInconsistent
)
43 GetQtInstance().RunInMainThread([&] {
44 m_pCheckBox
->setTristate(true);
45 m_pCheckBox
->setCheckState(bInconsistent
? Qt::PartiallyChecked
: Qt::Unchecked
);
49 bool QtInstanceCheckButton::get_inconsistent() const
53 GetQtInstance().RunInMainThread(
54 [&] { bInconsistent
= m_pCheckBox
->checkState() == Qt::PartiallyChecked
; });
58 void QtInstanceCheckButton::set_label(const OUString
& rText
)
61 GetQtInstance().RunInMainThread([&] { m_pCheckBox
->setText(toQString(rText
)); });
63 OUString
QtInstanceCheckButton::get_label() const
67 GetQtInstance().RunInMainThread([&] { sLabel
= toOUString(m_pCheckBox
->text()); });
71 void QtInstanceCheckButton::QtInstanceCheckButton::set_label_wrap(bool /*bWrap*/)
73 assert(false && "Not implemented yet");
76 void QtInstanceCheckButton::handleToggled()
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */