LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
centeredcheckbox.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_CENTEREDCHECKBOX_H
21 #define LIBREPCB_CENTEREDCHECKBOX_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include <QtCore>
27 #include <QtWidgets>
28 
29 /*******************************************************************************
30  * Namespace / Forward Declarations
31  ******************************************************************************/
32 namespace librepcb {
33 
34 /*******************************************************************************
35  * Class CenteredCheckBox
36  ******************************************************************************/
37 
41 class CenteredCheckBox final : public QWidget {
42  Q_OBJECT
43 
44 public:
45  // Constructors / Destructor
46  explicit CenteredCheckBox(QWidget* parent = nullptr) noexcept;
47  explicit CenteredCheckBox(const QString& text,
48  QWidget* parent = nullptr) noexcept;
49  CenteredCheckBox(const CenteredCheckBox& other) = delete;
50  ~CenteredCheckBox() noexcept;
51 
52  // Wrapper Methods
53  void setText(const QString& text) noexcept { mCheckBox->setText(text); }
54  bool isChecked() const noexcept { return mCheckBox->isChecked(); }
55  void setChecked(bool checked) noexcept { mCheckBox->setChecked(checked); }
56 
57  // Operator Overloadings
58  CenteredCheckBox& operator=(const CenteredCheckBox& rhs) = delete;
59 
60 signals:
61  void toggled(bool checked);
62  void clicked(bool checked);
63  void stateChanged(int state);
64 
65 private: // Data
66  QCheckBox* mCheckBox; // ownership by Qt's parent-child-mechanism
67 };
68 
69 /*******************************************************************************
70  * End of File
71  ******************************************************************************/
72 
73 } // namespace librepcb
74 
75 #endif // LIBREPCB_CENTEREDCHECKBOX_H
void clicked(bool checked)
void setChecked(bool checked) noexcept
Definition: centeredcheckbox.h:55
void stateChanged(int state)
bool isChecked() const noexcept
Definition: centeredcheckbox.h:54
QCheckBox * mCheckBox
Definition: centeredcheckbox.h:66
~CenteredCheckBox() noexcept
Definition: centeredcheckbox.cpp:55
void setText(const QString &text) noexcept
Definition: centeredcheckbox.h:53
The CenteredCheckBox class is a centered variant of the QCheckBox.
Definition: centeredcheckbox.h:41
CenteredCheckBox & operator=(const CenteredCheckBox &rhs)=delete
void toggled(bool checked)
CenteredCheckBox(QWidget *parent=nullptr) noexcept
Definition: centeredcheckbox.cpp:37