Seamly2D
Code documentation
dialogmove.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file dialogmove.cpp
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 30 9, 2016
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2016 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #include "dialogmove.h"
53 
54 #include <QColor>
55 #include <QComboBox>
56 #include <QDialog>
57 #include <QLabel>
58 #include <QLineEdit>
59 #include <QLineF>
60 #include <QPlainTextEdit>
61 #include <QPointF>
62 #include <QPointer>
63 #include <QPushButton>
64 #include <QRegularExpression>
65 #include <QRegularExpressionMatch>
66 #include <QSharedPointer>
67 #include <QStringList>
68 #include <QTimer>
69 #include <QToolButton>
70 #include <Qt>
71 #include <new>
72 
73 #include "../../visualization/visualization.h"
74 #include "../../visualization/line/operation/vistoolmove.h"
75 #include "../ifc/xml/vabstractpattern.h"
76 #include "../ifc/xml/vdomdocument.h"
77 #include "../qmuparser/qmudef.h"
78 #include "../support/edit_formula_dialog.h"
79 #include "../vgeometry/vpointf.h"
80 #include "../vmisc/vabstractapplication.h"
81 #include "../vmisc/vcommonsettings.h"
82 #include "../vpatterndb/vcontainer.h"
83 #include "../vpatterndb/vtranslatevars.h"
84 #include "../vwidgets/vabstractmainwindow.h"
85 #include "../vwidgets/vmaingraphicsscene.h"
86 #include "ui_dialogmove.h"
87 #include "../../tools/drawTools/operation/vabstractoperation.h"
88 
89 //---------------------------------------------------------------------------------------------------------------------
90 DialogMove::DialogMove(const VContainer *data, quint32 toolId, QWidget *parent)
91  : DialogTool(data, toolId, parent)
92  , ui(new Ui::DialogMove)
93  , angleFlag(false)
94  , angleFormula()
95  , angleTimer(nullptr)
96  , lengthFlag(false)
97  , lengthFormula()
98  , lengthTimer(nullptr)
99  , rotationFlag(false)
100  , rotationFormula()
101  , rotationTimer(nullptr)
102  , m_objects()
103  , stage1(true)
104  , stage2(false)
105  , m_suffix()
106  , useOriginPoint(false)
107 {
108  ui->setupUi(this);
109  setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
110  setWindowIcon(QIcon(":/toolicon/32x32/move.png"));
111 
112  ui->angle_PlainTextEdit->installEventFilter(this);
113  ui->length_PlainTextEdit->installEventFilter(this);
114  ui->rotation_PlainTextEdit->installEventFilter(this);
115 
116  ui->suffix_LineEdit->setText(qApp->getCurrentDocument()->GenerateSuffix(qApp->Settings()->getMoveSuffix()));
117 
118  angleTimer = new QTimer(this);
119  connect(angleTimer, &QTimer::timeout, this, &DialogMove::evaluateAngle);
120 
121  lengthTimer = new QTimer(this);
122  connect(lengthTimer, &QTimer::timeout, this, &DialogMove::evaluateLength);
123 
124  rotationTimer = new QTimer(this);
125  connect(rotationTimer, &QTimer::timeout, this, &DialogMove::evaluateRotation);
126 
128 
129  FillComboBoxPoints(ui->rotationPoint_ComboBox);
130  ui->rotationPoint_ComboBox->blockSignals(true);
131  ui->rotationPoint_ComboBox->addItem(tr("Center point"), NULL_ID);
132  ui->rotationPoint_ComboBox->blockSignals(false);
133 
134  flagName = true;
135  CheckState();
136 
137  connect(ui->suffix_LineEdit, &QLineEdit::textChanged, this, &DialogMove::suffixChanged);
138  connect(ui->angleFormula_ToolButton, &QPushButton::clicked, this, &DialogMove::editAngleFormula);
139  connect(ui->lengthFormula_ToolButton, &QPushButton::clicked, this, &DialogMove::editLengthFormula);
140  connect(ui->rotationFormula_ToolButton, &QPushButton::clicked, this, &DialogMove::editRotationFormula);
141 
142  connect(ui->angle_PlainTextEdit, &QPlainTextEdit::textChanged, this, &DialogMove::angleChanged);
143  connect(ui->length_PlainTextEdit, &QPlainTextEdit::textChanged, this, &DialogMove::lengthChanged);
144  connect(ui->rotation_PlainTextEdit, &QPlainTextEdit::textChanged, this, &DialogMove::rotationChanged);
145  connect(ui->rotationPoint_ComboBox, &QComboBox::currentTextChanged, this, &DialogMove::originChanged);
146 
147  vis = new VisToolMove(data);
148 
150 }
151 
152 //---------------------------------------------------------------------------------------------------------------------
154 {
155  delete ui;
156 }
157 
158 //---------------------------------------------------------------------------------------------------------------------
159 QString DialogMove::GetAngle() const
160 {
161  return qApp->TrVars()->TryFormulaFromUser(angleFormula, qApp->Settings()->GetOsSeparator());
162 }
163 
164 //---------------------------------------------------------------------------------------------------------------------
165 void DialogMove::SetAngle(const QString &value)
166 {
167  angleFormula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
168  ui->angle_PlainTextEdit->setPlainText(angleFormula);
169 
170  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
171  SCASSERT(operation != nullptr)
172  operation->SetAngle(angleFormula);
173 
174  MoveCursorToEnd(ui->angle_PlainTextEdit);
175 }
176 
177 //---------------------------------------------------------------------------------------------------------------------
178 QString DialogMove::GetLength() const
179 {
180  return qApp->TrVars()->TryFormulaFromUser(lengthFormula, qApp->Settings()->GetOsSeparator());
181 }
182 
183 //---------------------------------------------------------------------------------------------------------------------
184 void DialogMove::SetLength(const QString &value)
185 {
186  lengthFormula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
187  ui->length_PlainTextEdit->setPlainText(lengthFormula);
188 
189  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
190  SCASSERT(operation != nullptr)
191  operation->SetLength(lengthFormula);
192 
193  MoveCursorToEnd(ui->length_PlainTextEdit);
194 }
195 
196 //---------------------------------------------------------------------------------------------------------------------
197 QString DialogMove::getRotation() const
198 {
199  return qApp->TrVars()->TryFormulaFromUser(rotationFormula, qApp->Settings()->GetOsSeparator());
200 }
201 
202 //---------------------------------------------------------------------------------------------------------------------
203 void DialogMove::setRotation(const QString &value)
204 {
205  rotationFormula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
206  ui->rotation_PlainTextEdit->setPlainText(rotationFormula);
207 
208  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
209  SCASSERT(operation != nullptr)
210  operation->setRotation(rotationFormula);
211 
212  MoveCursorToEnd(ui->rotation_PlainTextEdit);
213 }
214 
215 //---------------------------------------------------------------------------------------------------------------------
216 QString DialogMove::getSuffix() const
217 {
218  return m_suffix;
219 }
220 
221 //---------------------------------------------------------------------------------------------------------------------
222 void DialogMove::setSuffix(const QString &value)
223 {
224  m_suffix = value;
225  ui->suffix_LineEdit->setText(value);
226 }
227 
228 //---------------------------------------------------------------------------------------------------------------------
230 {
231  return getCurrentObjectId(ui->rotationPoint_ComboBox);
232 }
233 
234 //---------------------------------------------------------------------------------------------------------------------
235 void DialogMove::setOriginPointId(const quint32 &value)
236 {
237  ChangeCurrentData(ui->rotationPoint_ComboBox, value);
238  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
239  SCASSERT(operation != nullptr)
240  operation->setOriginPointId(value);
241 }
242 
243 //---------------------------------------------------------------------------------------------------------------------
244 void DialogMove::ShowDialog(bool click)
245 {
246  if (stage1 && not click)
247  {
248  if (m_objects.isEmpty())
249  {
250  return;
251  }
252 
253  stage1 = false;
254  prepare = true;
255 
256  VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
257  SCASSERT(scene != nullptr)
258  scene->clearSelection();
259 
260  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
261  SCASSERT(operation != nullptr)
262  operation->setObjects(sourceToObjects(m_objects));
263  operation->VisualMode();
264 
265  VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
266  SCASSERT(window != nullptr)
267  connect(operation, &VisToolMove::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
268 
269  scene->ToggleArcSelection(false);
270  scene->ToggleElArcSelection(false);
271  scene->ToggleSplineSelection(false);
272  scene->ToggleSplinePathSelection(false);
273 
274  scene->ToggleArcHover(false);
275  scene->ToggleElArcHover(false);
276  scene->ToggleSplineHover(false);
277  scene->ToggleSplinePathHover(false);
278 
279  qApp->getSceneView()->allowRubberBand(false);
280  }
281  else if (!stage2 && !stage1 && prepare && click)
282  {
283  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
284  SCASSERT(operation != nullptr)
285 
286  if (operation->LengthValue() > 0)
287  {
288  angleFormula = qApp->TrVars()->FormulaToUser(operation->Angle(), qApp->Settings()->GetOsSeparator());
289  lengthFormula = qApp->TrVars()->FormulaToUser(operation->Length(), qApp->Settings()->GetOsSeparator());
290  operation->SetAngle(angleFormula);
291  operation->SetLength(lengthFormula);
292 
293  operation->RefreshGeometry();
294  emit ToolTip(operation->CurrentToolTip());
295  stage2 = true;
296  }
297  }
298  else if (!stage1 && stage2 && prepare && click)
299  {
300  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
301  SCASSERT(operation != nullptr)
302 
303  if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
304  {
305  if (!useOriginPoint)
306  {
307  operation->setOriginPointId(NULL_ID);
308  SetObject(NULL_ID, ui->rotationPoint_ComboBox, QString());
309  operation->RefreshGeometry();
310  }
311  useOriginPoint = false;
312  }
313  else
314  {
315  SetAngle(operation->Angle());
316  SetLength(operation->Length());
317  setRotation(operation->Rotation());
318  setModal(true);
319  emit ToolTip("");
320  angleTimer->start();
321  lengthTimer->start();
322  rotationTimer->start();
323  show();
324  }
325  }
326 }
327 
328 //---------------------------------------------------------------------------------------------------------------------
329 void DialogMove::ChosenObject(quint32 id, const SceneObject &type)
330 {
331  if (!stage1 && stage2 && prepare)
332  {
333  if (type == SceneObject::Point && QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
334  {
335  if (SetObject(id, ui->rotationPoint_ComboBox, QString()))
336  {
337  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
338  SCASSERT(operation != nullptr)
339 
340  operation->setOriginPointId(id);
341  operation->RefreshGeometry();
342  useOriginPoint = true;
343  }
344  }
345  }
346 }
347 
348 //---------------------------------------------------------------------------------------------------------------------
349 void DialogMove::SelectedObject(bool selected, quint32 id, quint32 tool)
350 {
351  Q_UNUSED(tool)
352  if (stage1)
353  {
354  auto object = std::find_if(m_objects.begin(), m_objects.end(),
355  [id](const SourceItem &item) { return item.id == id; });
356 
357  if (selected)
358  {
359  if (object == m_objects.cend())
360  {
361  SourceItem item;
362  item.id = id;
363  m_objects.append(item);
364  }
365  }
366  else
367  {
368  if (object != m_objects.end())
369  {
370  m_objects.erase(object);
371  }
372  }
373  }
374 }
375 
376 //---------------------------------------------------------------------------------------------------------------------
378 {
379  labelEditFormula = ui->editAngle_Label;
380  labelResultCalculation = ui->angleResult_Label;
381  ValFormulaChanged(angleFlag, ui->angle_PlainTextEdit, angleTimer, degreeSymbol);
382 }
383 
384 //---------------------------------------------------------------------------------------------------------------------
386 {
387  labelEditFormula = ui->editLength_Label;
388  labelResultCalculation = ui->lengthResult_Label;
389  ValFormulaChanged(lengthFlag, ui->length_PlainTextEdit, lengthTimer, degreeSymbol);
390 }
391 
392 //---------------------------------------------------------------------------------------------------------------------
394 {
395  labelEditFormula = ui->editRotation_Label;
396  labelResultCalculation = ui->rotationResult_Label;
397  ValFormulaChanged(rotationFlag, ui->rotation_PlainTextEdit, rotationTimer, degreeSymbol);
398 }
399 
400 //---------------------------------------------------------------------------------------------------------------------
402 {
403  EditFormulaDialog *dialog = new EditFormulaDialog(data, toolId, this);
404  dialog->setWindowTitle(tr("Edit angle"));
405  dialog->SetFormula(GetAngle());
406  dialog->setPostfix(degreeSymbol);
407  if (dialog->exec() == QDialog::Accepted)
408  {
409  SetAngle(dialog->GetFormula());
410  }
411  delete dialog;
412 }
413 
414 //---------------------------------------------------------------------------------------------------------------------
416 {
417  EditFormulaDialog *dialog = new EditFormulaDialog(data, toolId, this);
418  dialog->setWindowTitle(tr("Edit length"));
419  dialog->SetFormula(GetLength());
420  dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
421  if (dialog->exec() == QDialog::Accepted)
422  {
423  SetLength(dialog->GetFormula());
424  }
425  delete dialog;
426 }
427 
428 //---------------------------------------------------------------------------------------------------------------------
430 {
431  EditFormulaDialog *dialog = new EditFormulaDialog(data, toolId, this);
432  dialog->setWindowTitle(tr("Edit rotation"));
433  dialog->SetFormula(getRotation());
434  dialog->setPostfix(degreeSymbol);
435  if (dialog->exec() == QDialog::Accepted)
436  {
437  setRotation(dialog->GetFormula());
438  }
439  delete dialog;
440 }
441 
442 //---------------------------------------------------------------------------------------------------------------------
444 {
445  QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
446  if (edit)
447  {
448  const QString suffix = edit->text();
449  if (suffix.isEmpty())
450  {
451  flagName = false;
452  ChangeColor(ui->suffix_Label, Qt::red);
453  CheckState();
454  return;
455  }
456  else
457  {
458  if (m_suffix != suffix)
459  {
460  QRegularExpression rx(NameRegExp());
461  const QStringList uniqueNames = VContainer::AllUniqueNames();
462  for (int i=0; i < uniqueNames.size(); ++i)
463  {
464  const QString name = uniqueNames.at(i) + suffix;
465  if (not rx.match(name).hasMatch() || not data->IsUnique(name))
466  {
467  flagName = false;
468  ChangeColor(ui->suffix_Label, Qt::red);
469  CheckState();
470  return;
471  }
472  }
473  }
474  }
475 
476  flagName = true;
477  ChangeColor(ui->suffix_Label, okColor);
478  }
479  CheckState();
480 }
481 
482 //---------------------------------------------------------------------------------------------------------------------
483 void DialogMove::originChanged(const QString &text)
484 {
485  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
486  SCASSERT(operation != nullptr)
487  if (text == "Center Point")
488  {
489  operation->setOriginPointId(NULL_ID);
490  useOriginPoint = false;
491  }
492  else
493  {
494  operation->setOriginPointId(getCurrentObjectId(ui->rotationPoint_ComboBox));
495  useOriginPoint = true;
496  }
497  operation->RefreshGeometry();
498 }
499 
500 //---------------------------------------------------------------------------------------------------------------------
502 {
503  SCASSERT(ok_Button != nullptr)
504  ok_Button->setEnabled(angleFlag && lengthFlag && rotationFlag && flagName);
505  SCASSERT(apply_Button != nullptr)
506  apply_Button->setEnabled(ok_Button->isEnabled());
507 }
508 
509 //---------------------------------------------------------------------------------------------------------------------
511 {
512  AddVisualization<VisToolMove>();
513 }
514 
515 //---------------------------------------------------------------------------------------------------------------------
517 {
518  m_suffix = ui->suffix_LineEdit->text();
519 
520  angleFormula = ui->angle_PlainTextEdit->toPlainText();
521  angleFormula.replace("\n", " ");
522 
523  lengthFormula = ui->length_PlainTextEdit->toPlainText();
524  lengthFormula.replace("\n", " ");
525 
526  rotationFormula = ui->rotation_PlainTextEdit->toPlainText();
527  rotationFormula.replace("\n", " ");
528 
529  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
530  SCASSERT(operation != nullptr)
531 
532  operation->setObjects(sourceToObjects(m_objects));
533  operation->SetAngle(angleFormula);
534  operation->SetLength(lengthFormula);
535  operation->setRotation(rotationFormula);
536  operation->setOriginPointId(getOriginPointId());
537  operation->RefreshGeometry();
538 }
539 
540 //---------------------------------------------------------------------------------------------------------------------
541 void DialogMove::closeEvent(QCloseEvent *event)
542 {
543  ui->angle_PlainTextEdit->blockSignals(true);
544  ui->length_PlainTextEdit->blockSignals(true);
545  ui->rotation_PlainTextEdit->blockSignals(true);
546  DialogTool::closeEvent(event);
547 }
548 
549 //---------------------------------------------------------------------------------------------------------------------
551 {
552  return m_objects;
553 }
554 
555 //---------------------------------------------------------------------------------------------------------------------
557 {
558  m_objects = value;
559 
560  VisToolMove *operation = qobject_cast<VisToolMove *>(vis);
561  SCASSERT(operation != nullptr)
562  operation->setObjects(sourceToObjects(m_objects));
563 }
564 
565 //---------------------------------------------------------------------------------------------------------------------
567 {
568  labelEditFormula = ui->editAngle_Label;
569  Eval(ui->angle_PlainTextEdit->toPlainText(), angleFlag, ui->angleResult_Label, degreeSymbol, false);
570 }
571 
572 //---------------------------------------------------------------------------------------------------------------------
574 {
575  labelEditFormula = ui->editLength_Label;
576  const QString postfix = UnitsToStr(qApp->patternUnit(), true);
577  Eval(ui->length_PlainTextEdit->toPlainText(), lengthFlag, ui->lengthResult_Label, postfix);
578 }
579 
580 //---------------------------------------------------------------------------------------------------------------------
582 {
583  labelEditFormula = ui->editRotation_Label;
584  Eval(ui->rotation_PlainTextEdit->toPlainText(), rotationFlag, ui->rotationResult_Label, degreeSymbol, false);
585 }
void originChanged(const QString &text)
Definition: dialogmove.cpp:483
void SetAngle(const QString &value)
Definition: dialogmove.cpp:165
QString getRotation() const
Definition: dialogmove.cpp:197
QString angleFormula
angleFlag true if value of angle is correct *‍/
Definition: dialogmove.h:128
virtual ~DialogMove()
Definition: dialogmove.cpp:153
quint32 getOriginPointId() const
Definition: dialogmove.cpp:229
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
Definition: dialogmove.cpp:541
void suffixChanged()
Definition: dialogmove.cpp:443
void editAngleFormula()
Definition: dialogmove.cpp:401
QString GetAngle() const
Definition: dialogmove.cpp:159
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
Definition: dialogmove.cpp:516
QVector< SourceItem > m_objects
rotationTimer timer of check formula of rotation *‍/
Definition: dialogmove.h:136
void setSuffix(const QString &value)
Definition: dialogmove.cpp:222
QString rotationFormula
rotationFlag true if value of length is correct *‍/
Definition: dialogmove.h:134
void rotationChanged()
Definition: dialogmove.cpp:393
void evaluateAngle()
Definition: dialogmove.cpp:566
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
Definition: dialogmove.cpp:329
QString lengthFormula
lengthFlag true if value of length is correct *‍/
Definition: dialogmove.h:131
virtual void SelectedObject(bool selected, quint32 id, quint32 tool) Q_DECL_OVERRIDE
Definition: dialogmove.cpp:349
bool lengthFlag
angleTimer timer of check formula of angle *‍/
Definition: dialogmove.h:130
bool stage1
Definition: dialogmove.h:137
void setOriginPointId(const quint32 &value)
Definition: dialogmove.cpp:235
void lengthChanged()
Definition: dialogmove.cpp:385
void SetLength(const QString &value)
Definition: dialogmove.cpp:184
bool useOriginPoint
Definition: dialogmove.h:140
virtual void CheckState() Q_DECL_FINAL
CheckState enable, when all is correct, or disable, when something wrong, button ok.
Definition: dialogmove.cpp:501
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE
Definition: dialogmove.cpp:244
void evaluateLength()
Definition: dialogmove.cpp:573
bool rotationFlag
lengthTimer timer of check formula of length *‍/
Definition: dialogmove.h:133
QTimer * angleTimer
angle formula of angle *‍/
Definition: dialogmove.h:129
QString GetLength() const
Definition: dialogmove.cpp:178
QTimer * lengthTimer
length formula of length *‍/
Definition: dialogmove.h:132
bool angleFlag
Definition: dialogmove.h:127
QVector< SourceItem > getSourceObjects() const
Definition: dialogmove.cpp:550
void setSourceObjects(const QVector< SourceItem > &value)
Definition: dialogmove.cpp:556
QString getSuffix() const
Definition: dialogmove.cpp:216
bool stage2
Definition: dialogmove.h:138
void setRotation(const QString &value)
Definition: dialogmove.cpp:203
DialogMove(const VContainer *data, quint32 toolId, QWidget *parent=nullptr)
Definition: dialogmove.cpp:90
QString m_suffix
Definition: dialogmove.h:139
void editLengthFormula()
Definition: dialogmove.cpp:415
void editRotationFormula()
Definition: dialogmove.cpp:429
Ui::DialogMove * ui
Definition: dialogmove.h:126
void angleChanged()
Definition: dialogmove.cpp:377
QTimer * rotationTimer
rotationFormula of rotation *‍/
Definition: dialogmove.h:135
void evaluateRotation()
Definition: dialogmove.cpp:581
virtual void ShowVisualization() Q_DECL_OVERRIDE
Definition: dialogmove.cpp:510
The DialogTool class parent for all dialog of tools.
Definition: dialogtool.h:107
void ChangeCurrentData(QComboBox *box, const QVariant &value) const
ChangeCurrentData select item in combobox by id.
Definition: dialogtool.cpp:419
const QColor okColor
Definition: dialogtool.h:219
void ToolTip(const QString &toolTip)
ToolTip emit tooltipe for tool.
void FillComboBoxPoints(QComboBox *box, FillComboBox rule=FillComboBox::Whole, const quint32 &ch1=NULL_ID, const quint32 &ch2=NULL_ID) const
FillComboBoxPoints fill comboBox list of points.
Definition: dialogtool.cpp:242
bool flagName
flagName true if name is correct
Definition: dialogtool.h:183
void MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const
Definition: dialogtool.cpp:432
QPushButton * ok_Button
ok_Button button ok
Definition: dialogtool.h:199
qreal Eval(const QString &text, bool &flag, QLabel *label, const QString &postfix, bool checkZero=true, bool checkLessThanZero=false)
Eval evaluate formula and show result.
Definition: dialogtool.cpp:805
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
Definition: dialogtool.cpp:192
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer, const QString &postfix=QString())
ValFormulaChanged handle change formula.
Definition: dialogtool.cpp:744
bool SetObject(const quint32 &id, QComboBox *box, const QString &toolTip)
Definition: dialogtool.cpp:974
QPushButton * apply_Button
apply_Button button apply
Definition: dialogtool.h:202
quint32 toolId
Definition: dialogtool.h:225
QLabel * labelEditFormula
labelEditFormula label used when need show wrong formula
Definition: dialogtool.h:217
void initializeOkCancelApply(T *ui)
initializeOkCancelApply initialize OK / Cancel and Apply buttons
Definition: dialogtool.h:365
const VContainer * data
data container with data
Definition: dialogtool.h:177
bool prepare
prepare show if we prepare. Show dialog after finish working with visual part of tool
Definition: dialogtool.h:228
QLabel * labelResultCalculation
labelResultCalculation label with result of calculation
Definition: dialogtool.h:211
QPointer< Visualization > vis
Definition: dialogtool.h:236
void ChangeColor(QWidget *widget, const QColor &color)
quint32 getCurrentObjectId(QComboBox *box) const
getCurrentPointId return current point id stored in combobox
Definition: dialogtool.cpp:959
The EditFormulaDialog class dialog for editing wrong formula.
QString GetFormula() const
void SetFormula(const QString &value)
void setPostfix(const QString &value)
virtual void ShowToolTip(const QString &toolTip)=0
The VContainer class container of all variables.
Definition: vcontainer.h:141
static bool IsUnique(const QString &name)
Definition: vcontainer.cpp:585
static QStringList AllUniqueNames()
Definition: vcontainer.cpp:591
The VMainGraphicsScene class main scene.
void ToggleArcHover(bool enabled)
void ToggleSplinePathSelection(bool enabled)
void ToggleElArcHover(bool enabled)
void ToggleElArcSelection(bool enabled)
void ToggleSplinePathHover(bool enabled)
void ToggleSplineHover(bool enabled)
void ToggleSplineSelection(bool enabled)
void ToggleArcSelection(bool enabled)
void setObjects(QVector< quint32 > objects)
virtual void VisualMode(const quint32 &pointId=NULL_ID) Q_DECL_OVERRIDE
virtual void RefreshGeometry() Q_DECL_OVERRIDE
QString Length() const
QString Angle() const
void SetAngle(const QString &expression)
void setOriginPointId(quint32 value)
void setRotation(const QString &expression)
QString Rotation() const
qreal LengthValue() const
void SetLength(const QString &expression)
QString CurrentToolTip() const
Definition: visualization.h:88
void ToolTip(const QString &toolTip)
const QString degreeSymbol
Definition: def.cpp:196
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
Definition: def.cpp:702
#define SCASSERT(cond)
Definition: def.h:317
SceneObject
Definition: def.h:103
#define NULL_ID
Definition: ifcdef.h:76
QString NameRegExp()
Definition: qmudef.cpp:281
QVector< quint32 > sourceToObjects(const QVector< SourceItem > &source)
#define qApp
Definition: vapplication.h:67