1
git-svn-id: svn://db.shs.com.ru/libs@1 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
43
qad_widgets/qrectedit.h
Normal file
43
qad_widgets/qrectedit.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef QRECTEDIT_H
|
||||
#define QRECTEDIT_H
|
||||
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
#include "float.h"
|
||||
|
||||
|
||||
class QRectEdit: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QRectF value READ value WRITE setValue)
|
||||
Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
|
||||
|
||||
public:
|
||||
explicit QRectEdit(QWidget * parent = 0);
|
||||
~QRectEdit() {delete s_x; delete s_y; delete s_w; delete s_h; delete lbl_0; delete lbl_1; delete lbl_2;}
|
||||
|
||||
QRectF value() const {return QRectF(s_x->value(), s_y->value(), s_w->value(), s_h->value());}
|
||||
int decimals() const {return s_x->decimals();}
|
||||
|
||||
public slots:
|
||||
void setValue(QRectF v) {s_x->setValue(v.x()); s_y->setValue(v.y()); s_w->setValue(v.width()); s_h->setValue(v.height());}
|
||||
void setDecimals(int d) {s_x->setDecimals(d); s_y->setDecimals(d); s_w->setDecimals(d); s_h->setDecimals(d);}
|
||||
|
||||
private:
|
||||
virtual void changeEvent(QEvent * e);
|
||||
|
||||
QBoxLayout lay;
|
||||
QDoubleSpinBox * s_x, * s_y, * s_w, * s_h;
|
||||
QLabel * lbl_0, * lbl_1, * lbl_2;
|
||||
|
||||
private slots:
|
||||
void changed() {emit valueChanged(QRectF(s_x->value(), s_y->value(), s_w->value(), s_h->value()));}
|
||||
|
||||
signals:
|
||||
void valueChanged(QRectF);
|
||||
|
||||
};
|
||||
|
||||
#endif // QRECTEDIT_H
|
||||
Reference in New Issue
Block a user