/* PIQt Utils - Qt utilites for PIP Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef pivariant_edit_widgets_H #define pivariant_edit_widgets_H #include "pivariant_edit.h" #include #include #include class QAD_PIQT_UTILS_EXPORT PIVariantEditorBool: public PIVariantEditorBase { public: PIVariantEditorBool() { createBoxLayout(); widget = new QCheckBox(); layout()->addWidget(widget); } void setValue(const PIVariant & v) override {widget->setChecked(v.toBool());} PIVariant value() const override {return widget->isChecked();} private: QCheckBox * widget; }; class QAD_PIQT_UTILS_EXPORT PIVariantEditorInt: public PIVariantEditorBase { public: PIVariantEditorInt() { createBoxLayout(); widget = new QSpinBox(); layout()->addWidget(widget); } void setValue(const PIVariant & v) override {widget->setValue(v.toInt());} PIVariant value() const override {return widget->value();} PIVariantMap defaultAttributes() const override; private: void applyAttributes(const PIVariantMap & a) override; QSpinBox * widget; }; class QAD_PIQT_UTILS_EXPORT PIVariantEditorDouble: public PIVariantEditorBase { public: PIVariantEditorDouble() { createBoxLayout(); widget = new QDoubleSpinBox(); widget->setRange(-std::numeric_limits::max(), std::numeric_limits::max()); layout()->addWidget(widget); } void setValue(const PIVariant & v) override {widget->setValue(v.toDouble());} PIVariant value() const override {return widget->value();} PIVariantMap defaultAttributes() const override; private: void applyAttributes(const PIVariantMap & a) override; QDoubleSpinBox * widget; }; #endif