1 /* 2 * Replacement fot QT Bindings that were removed from QT5 3 * Copyright (C) 2020 Pedro de Carvalho Gomes <pedrogomes81@gmail.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef GUICHECKBOX_H 20 #define GUICHECKBOX_H 21 22 #include "QtBinding.h" 23 24 #include <QCheckBox> 25 26 namespace QtBindings 27 { 28 namespace Gui 29 { 30 class CheckBox : public QCheckBox, public QtBindings::Base<CheckBox> 31 { 32 Q_OBJECT 33 public: 34 Q_INVOKABLE CheckBox(QWidget *parent = Q_NULLPTR); 35 Q_INVOKABLE CheckBox(const CheckBox &other); 36 Q_INVOKABLE CheckBox(const QString &text, QWidget *parent = Q_NULLPTR); 37 Q_INVOKABLE ~CheckBox(); 38 CheckBox &operator=(const CheckBox &other); 39 public slots: 40 Qt::CheckState checkState() const; 41 bool isTristate() const; 42 void setCheckState(Qt::CheckState state); 43 void setTristate(bool y = true); 44 void setEnabled(bool enabled); 45 virtual QSize minimumSizeHint() const override; 46 virtual QSize sizeHint() const override; 47 }; 48 } 49 } 50 Q_DECLARE_METATYPE(QtBindings::Gui::CheckBox) 51 #endif //GUICHECKBOX_H 52