/* QAD - Qt ADvanced 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 QPOINTEDIT_H #define QPOINTEDIT_H #include "qad_widgets_export.h" #include #include #include #include class QAD_WIDGETS_EXPORT QPointEdit: public QWidget { Q_OBJECT Q_PROPERTY(QPointF value READ value WRITE setValue) Q_PROPERTY(int decimals READ decimals WRITE setDecimals) public: explicit QPointEdit(QWidget * parent = 0); ~QPointEdit() { delete s_x; delete s_y; delete lbl; } QPointF value() const { return QPointF(s_x->value(), s_y->value()); } int decimals() const { return s_x->decimals(); } public slots: void setValue(QPointF v) { s_x->setValue(v.x()); s_y->setValue(v.y()); } void setDecimals(int d) { s_x->setDecimals(d); s_y->setDecimals(d); } private: virtual void changeEvent(QEvent * e); QBoxLayout lay; QDoubleSpinBox *s_x, *s_y; QLabel * lbl; private slots: void changed() { emit valueChanged(QPointF(s_x->value(), s_y->value())); } signals: void valueChanged(QPointF); }; #endif // QPOINTEDIT_H