File indexing completed on 2024-12-15 04:13:19

0001 /*
0002  * SPDX-FileCopyrightText: 2007-2011 Kare Sars <kare.sars@iki .fi>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #ifndef LABELED_CHECKBOX_H
0008 #define LABELED_CHECKBOX_H
0009 
0010 #include "ksaneoptionwidget.h"
0011 
0012 // Qt includes
0013 #include <QCheckBox>
0014 #include <QGridLayout>
0015 
0016 namespace KSaneIface
0017 {
0018 
0019 /**
0020   *@author Kåre Särs
0021   */
0022 
0023 /**
0024  * A wrapper for a checkbox
0025  */
0026 class LabeledCheckbox : public KSaneOptionWidget
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031 
0032     /**
0033      * Create the checkbox.
0034      *
0035      * \param parent parent widget
0036      * \param text is the text describing the checkbox.
0037      */
0038     LabeledCheckbox(QWidget *parent, const QString &text);
0039 
0040     LabeledCheckbox(QWidget *parent, KSaneCore::Option *option);
0041     ~LabeledCheckbox() override;
0042     void setChecked(bool);
0043     bool isChecked();
0044 
0045 Q_SIGNALS:
0046     void toggled(bool);
0047 
0048 public Q_SLOTS:
0049     void setValue(const QVariant &value);
0050 
0051 protected:
0052     void initCheckBox(const QString &name);
0053 
0054 private:
0055 
0056     QCheckBox *chbx;
0057 };
0058 
0059 }  // NameSpace KSaneIface
0060 
0061 #endif // LABELED_CHECKBOX_H