33 #include "ui_intersect_circles_dialog.h"
35 #include "../ifc/xml/vdomdocument.h"
36 #include "../support/edit_formula_dialog.h"
37 #include "../vmisc/vabstractapplication.h"
38 #include "../vmisc/vcommonsettings.h"
39 #include "../vpatterndb/vtranslatevars.h"
40 #include "../../visualization/visualization.h"
41 #include "../../visualization/line/intersect_circles_visual.h"
49 #include <QPlainTextEdit>
51 #include <QPushButton>
53 #include <QToolButton>
60 , flagCircle1Radius(false)
61 , flagCircle2Radius(false)
62 , timerCircle1Radius(nullptr)
63 , timerCircle2Radius(nullptr)
66 , formulaBaseHeightCircle1Radius(0)
67 , formulaBaseHeightCircle2Radius(0)
70 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
71 setWindowIcon(QIcon(
":/toolicon/32x32/point_of_intersection_circles.png"));
73 ui->lineEditNamePoint->setClearButtonEnabled(
true);
82 ui->plainTextEditCircle1Radius->installEventFilter(
this);
83 ui->plainTextEditCircle2Radius->installEventFilter(
this);
98 connect(
ui->lineEditNamePoint, &QLineEdit::textChanged,
101 connect(
ui->comboBoxCircle1Center, &QComboBox::currentTextChanged,
104 connect(
ui->comboBoxCircle2Center, &QComboBox::currentTextChanged,
107 connect(
ui->toolButtonExprCircle1Radius, &QPushButton::clicked,
this,
110 connect(
ui->toolButtonExprCircle2Radius, &QPushButton::clicked,
this,
113 connect(
ui->plainTextEditCircle1Radius, &QPlainTextEdit::textChanged,
this,
116 connect(
ui->plainTextEditCircle2Radius, &QPlainTextEdit::textChanged,
this,
119 connect(
ui->pushButtonGrowCircle1Radius, &QPushButton::clicked,
this,
122 connect(
ui->pushButtonGrowCircle2Radius, &QPushButton::clicked,
this,
176 return qApp->TrVars()->TryFormulaFromUser(
ui->plainTextEditCircle1Radius->toPlainText(),
177 qApp->Settings()->GetOsSeparator());
183 const QString formula =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
185 if (formula.length() > 80)
189 ui->plainTextEditCircle1Radius->setPlainText(formula);
201 return qApp->TrVars()->TryFormulaFromUser(
ui->plainTextEditCircle2Radius->toPlainText(),
202 qApp->Settings()->GetOsSeparator());
208 const QString formula =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
210 if (formula.length() > 80)
214 ui->plainTextEditCircle2Radius->setPlainText(formula);
226 return getCurrentCrossPoint<CrossCirclesPoint>(
ui->comboBoxResult);
232 const qint32 index =
ui->comboBoxResult->findData(
static_cast<int>(p));
235 ui->comboBoxResult->setCurrentIndex(index);
256 if (
SetObject(
id,
ui->comboBoxCircle1Center, tr(
"Select second circle center")))
271 this->setModal(
true);
336 dialog->setWindowTitle(tr(
"Edit first circle radius"));
339 if (dialog->exec() == QDialog::Accepted)
350 dialog->setWindowTitle(tr(
"Edit second circle radius"));
353 if (dialog->exec() == QDialog::Accepted)
366 ui->labelResultCircle1Radius, postfix);
372 ui->labelResultCircle1Radius->setText(tr(
"Error"));
373 ui->labelResultCircle1Radius->setToolTip(tr(
"Radius can't be negative"));
385 ui->labelResultCircle2Radius, postfix);
391 ui->labelResultCircle2Radius->setText(tr(
"Error"));
392 ui->labelResultCircle2Radius->setToolTip(tr(
"Radius can't be negative"));
401 AddVisualization<IntersectCirclesVisual>();
409 QString c1Radius =
ui->plainTextEditCircle2Radius->toPlainText();
410 c1Radius.replace(
"\n",
" ");
412 QString c2Radius =
ui->plainTextEditCircle2Radius->toPlainText();
413 c2Radius.replace(
"\n",
" ");
429 ui->plainTextEditCircle1Radius->blockSignals(
true);
430 ui->plainTextEditCircle2Radius->blockSignals(
true);
void DeployCircle1RadiusTextEdit()
void SetFirstCircleRadius(const QString &value)
void SetSecondCircleRadius(const QString &value)
quint32 GetFirstCircleCenterId() const
QString GetSecondCircleRadius() const
int formulaBaseHeightCircle2Radius
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
void Circle1RadiusChanged()
QTimer * timerCircle1Radius
virtual ~IntersectCirclesDialog() Q_DECL_OVERRIDE
int formulaBaseHeightCircle1Radius
void SetPointName(const QString &value)
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
QTimer * timerCircle2Radius
virtual void ShowVisualization() Q_DECL_OVERRIDE
Ui::IntersectCirclesDialog * ui
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
CrossCirclesPoint GetCrossCirclesPoint() const
quint32 GetSecondCircleCenterId() const
void SetFirstCircleCenterId(const quint32 &value)
void SetSecondCircleCenterId(const quint32 &value)
void setCirclesCrossPoint(const CrossCirclesPoint &p)
QString GetFirstCircleRadius() const
void DeployCircle2RadiusTextEdit()
void Circle2RadiusChanged()
virtual void CheckState() Q_DECL_FINAL
CheckState enable, when all is correct, or disable, when something wrong, button ok.
IntersectCirclesDialog(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
void setC1Radius(const QString &value)
virtual void RefreshGeometry() Q_DECL_OVERRIDE
void setObject2Id(const quint32 &value)
void setCrossPoint(const CrossCirclesPoint &value)
virtual void VisualMode(const quint32 &id) Q_DECL_OVERRIDE
void setC2Radius(const QString &value)
The VContainer class container of all variables.
void setObject1Id(const quint32 &value)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.