This repository has been archived on 2020-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libs/qad/widgets/qpointedit.cpp
2020-05-25 16:59:19 +03:00

35 lines
925 B
C++

#include "qpointedit.h"
#include "float.h"
QPointEdit::QPointEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRight, this) {
s_x = new QDoubleSpinBox(this);
s_y = new QDoubleSpinBox(this);
s_x->setMinimum(-DBL_MAX);
s_x->setMaximum(DBL_MAX);
s_y->setMinimum(-DBL_MAX);
s_y->setMaximum(DBL_MAX);
s_x->setToolTip(tr("X"));
s_y->setToolTip(tr("Y"));
lbl = new QLabel(this);
lbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
lbl->setText("x");
lay.setContentsMargins(0, 0, 0, 0);
lay.setSpacing(1);
lay.addWidget(s_x);
lay.addWidget(lbl);
lay.addWidget(s_y);
connect(s_x, SIGNAL(valueChanged(double)), this, SLOT(changed()));
connect(s_y, SIGNAL(valueChanged(double)), this, SLOT(changed()));
}
void QPointEdit::changeEvent(QEvent * e) {
QWidget::changeEvent(e);
if (e->type() == QEvent::LanguageChange) {
s_x->setToolTip(tr("X"));
s_y->setToolTip(tr("Y"));
return;
}
}