git-svn-id: svn://db.shs.com.ru/libs@334 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -13,34 +13,6 @@
|
||||
__GraphicRegistrator__ __graphic_registrator__;
|
||||
|
||||
|
||||
ELineEdit::ELineEdit(QWidget * parent): CLineEdit(parent) {
|
||||
last_ret = complexd_0;
|
||||
is_auto = false;
|
||||
is_reset = true;
|
||||
connect(this, SIGNAL(editingFinished()), this, SLOT(calculate()));
|
||||
connect(this, SIGNAL(cleared()), this, SLOT(toDefaultClicked()));
|
||||
}
|
||||
|
||||
|
||||
void ELineEdit::wheelEvent(QWheelEvent * e) {
|
||||
double mul = 1.1;
|
||||
if (e->delta() < 0) mul = 0.9;
|
||||
CLineEdit::setText(QString::number(last_ret.real() * mul).toUpper());
|
||||
calculate();
|
||||
}
|
||||
|
||||
|
||||
void ELineEdit::calculate() {
|
||||
evaluator.check(text().replace(",", "."));
|
||||
if (!evaluator.isCorrect()) return;
|
||||
is_reset = false;
|
||||
last_ret = evaluator.evaluate();
|
||||
CLineEdit::setText(QString::number(last_ret.real()).toUpper());
|
||||
emit valueChanged(last_ret.real());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Graphic::Graphic(QWidget * parent): QFrame(parent), line_x_min(this), line_x_max(this), line_y_min(this), line_y_max(this) {
|
||||
QTranslator * trans = new QTranslator();
|
||||
trans->load(":/lang/qad_graphic_" + QLocale::system().name().left(2));
|
||||
@@ -66,6 +38,10 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), line_x_min(this), line_x_max
|
||||
LN2 = qLn(2.);
|
||||
LN5 = qLn(5.);
|
||||
LN10 = qLn(10.);
|
||||
line_x_min.setClearButtonVisible(true);
|
||||
line_x_max.setClearButtonVisible(true);
|
||||
line_y_min.setClearButtonVisible(true);
|
||||
line_y_max.setClearButtonVisible(true);
|
||||
connect(&line_x_min, SIGNAL(valueChanged(double)), this, SLOT(lineXMinChanged(double)));
|
||||
connect(&line_x_max, SIGNAL(valueChanged(double)), this, SLOT(lineXMaxChanged(double)));
|
||||
connect(&line_y_min, SIGNAL(valueChanged(double)), this, SLOT(lineYMinChanged(double)));
|
||||
@@ -1249,26 +1225,44 @@ void Graphic::swapToBuffer() {
|
||||
|
||||
void Graphic::setRectToLines() {
|
||||
is_lines_update = true;
|
||||
line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = true;
|
||||
//line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = true;
|
||||
//qDebug() << "set to lines" << selrect;
|
||||
line_x_min.is_reset = line_x_max.is_reset = line_y_min.is_reset = line_y_max.is_reset = isFit;
|
||||
if (!line_x_min.hasFocus()) line_x_min.setValue(selrect.left());
|
||||
if (!line_x_max.hasFocus()) line_x_max.setValue(selrect.right());
|
||||
if (!line_y_min.hasFocus()) line_y_min.setValue(selrect.bottom());
|
||||
if (!line_y_max.hasFocus()) line_y_max.setValue(selrect.top());
|
||||
if (!isFit) {
|
||||
//line_x_min.is_reset = line_x_max.is_reset = line_y_min.is_reset = line_y_max.is_reset = isFit;
|
||||
if (line_x_min.isVisible() && line_x_max.isVisible() && line_y_min.isVisible() && line_y_max.isVisible()) {
|
||||
line_x_min.blockSignals(true); line_x_max.blockSignals(true); line_y_min.blockSignals(true); line_y_max.blockSignals(true);
|
||||
if (!line_x_min.hasFocus()) {
|
||||
if (isFit) line_x_min.setValue(grect.left());
|
||||
else line_x_min.setValue(selrect.left());
|
||||
}
|
||||
if (!line_x_max.hasFocus()) {
|
||||
if(isFit) line_x_max.setValue(grect.right());
|
||||
else line_x_max.setValue(selrect.right());
|
||||
}
|
||||
if (!line_y_min.hasFocus()) {
|
||||
if(isFit) line_y_min.setValue(grect.bottom());
|
||||
else line_y_min.setValue(selrect.bottom());
|
||||
}
|
||||
if (!line_y_max.hasFocus()) {
|
||||
if(isFit) line_y_max.setValue(grect.top());
|
||||
else line_y_max.setValue(selrect.top());
|
||||
}
|
||||
line_x_min.setDefaultText(QString::number(grect.left()).toUpper());
|
||||
line_x_max.setDefaultText(QString::number(grect.right()).toUpper());
|
||||
line_y_min.setDefaultText(QString::number(grect.bottom()).toUpper());
|
||||
line_y_max.setDefaultText(QString::number(grect.top()).toUpper());
|
||||
line_x_min.blockSignals(false); line_x_max.blockSignals(false); line_y_min.blockSignals(false); line_y_max.blockSignals(false);
|
||||
// if(isFit) {
|
||||
// line_y_min.setValue(grect.left());
|
||||
// line_y_max.setValue(grect.left());
|
||||
// }
|
||||
}
|
||||
line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = false;
|
||||
//line_x_min.is_auto = line_x_max.is_auto = line_y_min.is_auto = line_y_max.is_auto = false;
|
||||
is_lines_update = false;
|
||||
}
|
||||
|
||||
|
||||
void Graphic::checkLines() {
|
||||
isFit = (line_x_min.isDefault() && line_x_max.isDefault() && line_y_min.isDefault() && line_y_max.isDefault());
|
||||
isFit = (line_x_min.isCleared() && line_x_max.isCleared() && line_y_min.isCleared() && line_y_max.isCleared());
|
||||
update(true);
|
||||
}
|
||||
|
||||
@@ -1549,6 +1543,7 @@ void Graphic::setBorderInputsVisible(bool visible) {
|
||||
ui->widgetLX->setVisible(visible);
|
||||
ui->widgetLY->setVisible(visible);
|
||||
ui->checkBorderInputs->setChecked(visible);
|
||||
if (visible) setRectToLines();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user