52 #include <QPlainTextEdit>
54 #include <QPushButton>
56 #include <QToolButton>
59 #include "../ifc/xml/vdomdocument.h"
60 #include "../vgeometry/vpointf.h"
62 #include "../vpatterndb/vcontainer.h"
63 #include "../vpatterndb/vtranslatevars.h"
64 #include "../../visualization/path/vistoolarc.h"
65 #include "../../visualization/visualization.h"
66 #include "../support/edit_formula_dialog.h"
67 #include "../vmisc/vabstractapplication.h"
68 #include "../vmisc/vcommonsettings.h"
69 #include "ui_dialogarc.h"
83 , timerRadius(nullptr)
89 , formulaBaseHeight(0)
90 , formulaBaseHeightF1(0)
91 , formulaBaseHeightF2(0)
99 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
100 setWindowIcon(QIcon(
":/toolicon/32x32/arc.png"));
108 ui->plainTextEditFormula->installEventFilter(
this);
109 ui->plainTextEditF1->installEventFilter(
this);
110 ui->plainTextEditF2->installEventFilter(
this);
128 ui->lineType_ComboBox->removeItem(index);
131 index =
ui->lineColor_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineColor());
134 ui->lineColor_ComboBox->setCurrentIndex(index);
137 index =
ui->lineWeight_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineWeight());
140 ui->lineWeight_ComboBox->setCurrentIndex(index);
143 index =
ui->lineType_ComboBox->findData(
qApp->getCurrentDocument()->getDefaultLineType());
146 ui->lineType_ComboBox->setCurrentIndex(index);
213 vis->setObject1Id(value);
223 f2 =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
225 if (
f2.length() > 80)
229 ui->plainTextEditF2->setPlainText(
f2);
289 f1 =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
291 if (
f1.length() > 80)
295 ui->plainTextEditF1->setPlainText(
f1);
311 radius =
qApp->TrVars()->FormulaToUser(value,
qApp->Settings()->GetOsSeparator());
317 ui->plainTextEditFormula->setPlainText(
radius);
342 this->setModal(
true);
352 AddVisualization<VisToolArc>();
358 radius =
ui->plainTextEditFormula->toPlainText();
359 radius.replace(
"\n",
" ");
360 f1 =
ui->plainTextEditF1->toPlainText();
361 f1.replace(
"\n",
" ");
362 f2 =
ui->plainTextEditF2->toPlainText();
363 f2.replace(
"\n",
" ");
378 ui->plainTextEditFormula->blockSignals(
true);
379 ui->plainTextEditF1->blockSignals(
true);
380 ui->plainTextEditF2->blockSignals(
true);
422 dialog->setWindowTitle(tr(
"Edit radius"));
425 if (dialog->exec() == QDialog::Accepted)
436 dialog->setWindowTitle(tr(
"Edit first angle"));
439 if (dialog->exec() == QDialog::Accepted)
450 dialog->setWindowTitle(tr(
"Edit second angle"));
453 if (dialog->exec() == QDialog::Accepted)
487 ui->name_LineEdit->setText(
qApp->TrVars()->VarToUser(arc.
name() +
"_" + QString().setNum(
m_Id + 1)));
491 ui->name_LineEdit->setText(
qApp->TrVars()->VarToUser(arc.
name() +
"_" + QString().setNum(
m_arc.
id())));
526 ui->labelResultRadius->setText(tr(
"Error"));
527 ui->labelResultRadius->setToolTip(tr(
"Radius can't be negative"));
551 if (
static_cast<int>(
angleF1) == INT_MIN ||
static_cast<int>(
angleF2) == INT_MIN)
560 ui->labelResultF1->setText(tr(
"Error"));
561 ui->labelResultF1->setToolTip(tr(
"Angles equal"));
565 ui->labelResultF2->setText(tr(
"Error"));
566 ui->labelResultF2->setToolTip(tr(
"Angles equal"));
589 return qApp->TrVars()->TryFormulaFromUser(
radius,
qApp->Settings()->GetOsSeparator());
599 return qApp->TrVars()->TryFormulaFromUser(
f1,
qApp->Settings()->GetOsSeparator());
609 return qApp->TrVars()->TryFormulaFromUser(
f2,
qApp->Settings()->GetOsSeparator());
The DialogArc class dialog for ToolArc. Help create arc and edit option.
QString getLineWeight() const
getLineWeight return weight of the lines
QString f1
f1 formula of first angle
bool flagF2
flagF2 true if value of second angle is correct
void EvalF()
EvalF1 calculate value of angle.
void setLineColor(const QString &value)
QString getRadius() const
getRadius return formula of radius
QString getF1() const
getF1 return formula first angle of arc
bool flagRadius
flagRadius true if value of radius is correct
Ui::DialogArc * ui
ui keeps information about user interface
void setF1(const QString &value)
setF1 set formula first angle of arc
QString getLineColor() const
void EvalRadius()
EvalRadius calculate value of radius.
virtual ~DialogArc() Q_DECL_OVERRIDE
QString getPenStyle() const
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
bool flagF1
flagF1 true if value of first angle is correct
void setPenStyle(const QString &value)
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
quint32 getCenter() const
getCenter return id of center point
void setF2(const QString &value)
setF2 set formula second angle of arc
void F2Changed()
F2Changed after change formula of second angle calculate value and show result.
void setRadius(const QString &value)
setRadius set formula of radius
DialogArc(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
DialogArc create dialog.
QTimer * timerF1
timerF1 timer of check formula of first angle
void setArc(const VArc &arc)
virtual void ShowVisualization() Q_DECL_OVERRIDE
void setLineWeight(const QString &value)
setLineWeight set weight of the lines
QTimer * timerF2
timerF2 timer of check formula of second angle
QTimer * timerRadius
timerRadius timer of check formula of radius
void F1Changed()
F1Changed after change formula of first angle calculate value and show result.
int formulaBaseHeight
formulaBaseHeight base height defined by dialogui
void RadiusChanged()
RadiusChanged after change formula of radius calculate value and show result.
virtual void CheckState() Q_DECL_FINAL
CheckState if all is right enable button ok.
void setCenter(const quint32 &value)
setCenter set id of center point
void DeployFormulaTextEdit()
DeployFormulaTextEdit grow or shrink formula input.
QString radius
radius formula of radius
QString f2
f2 formula of second angle
QString getF2() const
getF2 return formula second angle of arc
virtual VPointF GetCenter() const
void SetDuplicate(quint32 number)
VArc class for anticlockwise arc.
The VContainer class container of all variables.
static bool IsUnique(const QString &name)
const QSharedPointer< T > GeometricObject(const quint32 &id) const
virtual QString name() const
name return name graphical object.
quint32 id() const
id return id object.
The VPointF class keep data of point.
void setObject1Id(const quint32 &value)
const QString degreeSymbol
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
const QString LineTypeSolidLine
const QString LineTypeNone