Seamly2D
Code documentation
DialogVariables Class Reference

The DialogVariables class show dialog increments. Tables of all variables in program will be here. More...

#include <dialogvariables.h>

Inheritance diagram for DialogVariables:
Collaboration diagram for DialogVariables:

Signals

void updateProperties ()
 
- Signals inherited from DialogTool
void DialogClosed (int result)
 DialogClosed signal dialog closed. More...
 
void DialogApplied ()
 DialogApplied emit signal dialog apply changes. More...
 
void ToolTip (const QString &toolTip)
 ToolTip emit tooltipe for tool. More...
 

Public Member Functions

 DialogVariables (VContainer *data, VPattern *doc, QWidget *parent=nullptr)
 DialogVariables create dialog. More...
 
virtual ~DialogVariables () Q_DECL_OVERRIDE
 
- Public Member Functions inherited from DialogTool
 DialogTool (const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
 DialogTool create dialog. More...
 
virtual ~DialogTool () Q_DECL_OVERRIDE
 
VAbstractToolGetAssociatedTool ()
 
void SetAssociatedTool (VAbstractTool *tool)
 
virtual void ShowDialog (bool click)
 
virtual void Build (const Tool &type)
 
virtual void SetPiecesList (const QVector< quint32 > &list)
 
quint32 GetToolId () const
 
void SetToolId (const quint32 &value)
 
QString getPointName () const
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *event) Q_DECL_OVERRIDE
 closeEvent handle when dialog cloded More...
 
virtual void changeEvent (QEvent *event) Q_DECL_OVERRIDE
 
virtual bool eventFilter (QObject *object, QEvent *event) Q_DECL_OVERRIDE
 
virtual void showEvent (QShowEvent *event) Q_DECL_OVERRIDE
 showEvent handle when window show More...
 
virtual void resizeEvent (QResizeEvent *event) Q_DECL_OVERRIDE
 
- Protected Member Functions inherited from DialogTool
virtual void keyPressEvent (QKeyEvent *event) Q_DECL_OVERRIDE
 
void FillComboBoxPiecesList (QComboBox *box, const QVector< quint32 > &list)
 
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. More...
 
void FillComboBoxArcs (QComboBox *box, FillComboBox rule=FillComboBox::Whole, const quint32 &ch1=NULL_ID, const quint32 &ch2=NULL_ID) const
 
void FillComboBoxSplines (QComboBox *box) const
 
void FillComboBoxSplinesPath (QComboBox *box) const
 
void FillComboBoxCurves (QComboBox *box) const
 
void FillComboBoxTypeLine (QComboBox *box, const QMap< QString, QIcon > &stylesPics) const
 FillComboBoxTypeLine fill comboBox list of type lines. More...
 
void FillComboBoxLineColors (QComboBox *box) const
 
void FillComboBoxCrossCirclesPoints (QComboBox *box) const
 
void FillComboBoxVCrossCurvesPoint (QComboBox *box) const
 
void FillComboBoxHCrossCurvesPoint (QComboBox *box) const
 
virtual void CheckState ()
 CheckState enable, when all is correct, or disable, when something wrong, button ok. More...
 
QString GetComboBoxCurrentData (const QComboBox *box, const QString &def) const
 
void ChangeCurrentData (QComboBox *box, const QVariant &value) const
 ChangeCurrentData select item in combobox by id. More...
 
void ValFormulaChanged (bool &flag, QLineEdit *edit, QTimer *timer, const QString &postfix=QString())
 ValFormulaChanged handle change formula. More...
 
void ValFormulaChanged (bool &flag, QPlainTextEdit *edit, QTimer *timer, const QString &postfix=QString())
 
qreal Eval (const QString &text, bool &flag, QLabel *label, const QString &postfix, bool checkZero=true, bool checkLessThanZero=false)
 Eval evaluate formula and show result. More...
 
qreal normalize (const qreal value, const qreal start, const qreal end)
 
void setCurrentPointId (QComboBox *box, const quint32 &value, FillComboBox rule=FillComboBox::NoChildren, const quint32 &ch1=NULL_ID, const quint32 &ch2=NULL_ID) const
 
void setCurrentSplineId (QComboBox *box, const quint32 &value) const
 setCurrentSplineId set current spline id in combobox More...
 
void setCurrentArcId (QComboBox *box, const quint32 &value, FillComboBox rule=FillComboBox::NoChildren, const quint32 &ch1=NULL_ID, const quint32 &ch2=NULL_ID) const
 setCurrentArcId More...
 
void setCurrentSplinePathId (QComboBox *box, const quint32 &value) const
 setCurrentSplinePathId set current splinePath id in combobox More...
 
void setCurrentCurveId (QComboBox *box, const quint32 &value) const
 
quint32 getCurrentObjectId (QComboBox *box) const
 getCurrentPointId return current point id stored in combobox More...
 
template<typename T >
getCurrentCrossPoint (QComboBox *box) const
 
bool SetObject (const quint32 &id, QComboBox *box, const QString &toolTip)
 
void DeployFormula (QPlainTextEdit *formula, QPushButton *buttonGrowLength, int formulaBaseHeight)
 
template<typename T >
void initializeOkCancelApply (T *ui)
 initializeOkCancelApply initialize OK / Cancel and Apply buttons More...
 
template<typename T >
void initializeOkCancel (T *ui)
 initializeOkCancel initialize OK and Cancel buttons More...
 
template<typename T >
void initializeFormulaUi (T *ui)
 initializeFormulaUi initialize ui object for the formula field More...
 
template<typename T >
void AddVisualization ()
 
template<typename T >
QVector< T > GetListInternals (const QListWidget *list) const
 
void ChangeColor (QWidget *widget, const QColor &color)
 
virtual void ShowVisualization ()
 
virtual void SaveData ()
 SaveData Put dialog data in local variables. More...
 
void MoveCursorToEnd (QPlainTextEdit *plainTextEdit) const
 
quint32 DNumber (const QString &baseName) const
 
NodeInfo getNodeInfo (const VPieceNode &node, bool showNotch=false) const
 
void newNodeItem (QListWidget *listWidget, const VPieceNode &node, bool nodeExcluded=true, bool isDuplicate=false)
 
void initializeNodeAngles (QComboBox *box)
 

Private Slots

void showCustomVariableDetails ()
 
void filterVariables (const QString &filterString)
 
void addCustomVariable ()
 clickedToolButtonAdd create new row in table More...
 
void removeCustomVariable ()
 clickedToolButtonRemove remove one row from table More...
 
void moveUp ()
 
void moveDown ()
 
void saveCustomVariableName (const QString &text)
 
void saveCustomVariableDescription ()
 
void saveCustomVariableFormula ()
 
void Fx ()
 
void FullUpdateFromFile ()
 FullUpdateFromFile update information in tables form file. More...
 
void refreshPattern ()
 

Private Member Functions

template<typename T >
void fillTable (const QMap< QString, T > &varTable, QTableWidget *table)
 
void fillCustomVariables (bool freshCall=false)
 fillCustomVariables fill data for variables table More...
 
void fillLineLengths ()
 FillLengthLines fill data for table of lines lengths. More...
 
void fillLineAngles ()
 
void fillCurveLengths ()
 FillLengthSplines fill data for table of splines lengths. More...
 
void fillControlPointLengths ()
 
void fillArcsRadiuses ()
 
void fillCurveAngles ()
 
void showUnits ()
 
void showHeaderUnits (QTableWidget *table, int column, const QString &unit)
 
void addCell (QTableWidget *table, const QString &text, int row, int column, int aligment, bool ok=true)
 
QString getCustomVariableName () const
 
QString clearCustomVariableName (const QString &name) const
 
bool evalVariableFormula (const QString &formula, bool fromUser, VContainer *data, QLabel *label)
 
void setMoveControls ()
 
void enablePieces (bool enabled)
 
void localUpdateTree ()
 
bool variableUsed (const QString &name) const
 
void renameCache (const QString &name, const QString &newName)
 

Private Attributes

Ui::DialogVariables * ui
 ui keeps information about user interface More...
 
VContainerdata
 data container with data More...
 
VPatterndoc
 doc dom document container More...
 
int formulaBaseHeight
 
bool hasChanges
 
QVector< QPair< QString, QString > > renameList
 
QList< QSharedPointer< QTableWidget > > tableList
 
bool isSorted
 
bool isFiltered
 

Additional Inherited Members

- Public Slots inherited from DialogTool
virtual void ChosenObject (quint32 id, const SceneObject &type)
 ChosenObject gets id and type of selected object. Save right data and ignore wrong. More...
 
virtual void SelectedObject (bool selected, quint32 object, quint32 tool)
 
void NamePointChanged ()
 NamePointChanged check name of point. More...
 
virtual void DialogAccepted ()
 DialogAccepted save data and emit signal about closed dialog. More...
 
virtual void DialogApply ()
 DialogApply save data and emit signal DialogApplied. More...
 
virtual void DialogRejected ()
 DialogRejected emit signal dialog rejected. More...
 
void FormulaChanged ()
 formula check formula More...
 
void FormulaChangedPlainText ()
 FormulaChangedPlainText check formula (plain text editor editor) More...
 
void ArrowUp ()
 ArrowUp set angle value 90 degree. More...
 
void ArrowDown ()
 ArrowDown set angle value 270 degree. More...
 
void ArrowLeft ()
 ArrowLeft set angle value 180 degree. More...
 
void ArrowRight ()
 ArrowRight set angle value 0 degree. More...
 
void ArrowLeftUp ()
 ArrowLeftUp set angle value 135 degree. More...
 
void ArrowLeftDown ()
 ArrowLeftDown set angle value 225 degree. More...
 
void ArrowRightUp ()
 ArrowRightUp set angle value 45 degree. More...
 
void ArrowRightDown ()
 ArrowRightDown set angle value 315 degree. More...
 
virtual void EvalFormula ()
 EvalFormula evaluate formula. More...
 
virtual void PointNameChanged ()
 
- Static Public Member Functions inherited from DialogTool
static void moveListRowTop (QListWidget *list)
 
static void moveListRowUp (QListWidget *list)
 
static void moveListRowDown (QListWidget *list)
 
static void moveListRowBottom (QListWidget *list)
 
- Static Protected Member Functions inherited from DialogTool
static int FindNotExcludedNodeDown (QListWidget *listWidget, int candidate)
 
static int FindNotExcludedNodeUp (QListWidget *listWidget, int candidate)
 
static bool isFirstPointSameAsLast (QListWidget *listWidget)
 
static bool doublePointsExist (QListWidget *listWidget)
 
static bool isEachPointNameUnique (QListWidget *listWidget)
 
static QString DialogWarningIcon ()
 
static QFont NodeFont (bool nodeExcluded)
 
- Protected Attributes inherited from DialogTool
const VContainerdata
 data container with data More...
 
bool isInitialized
 isInitialized true if window is initialized More...
 
bool flagName
 flagName true if name is correct More...
 
bool flagFormula
 flagFormula true if formula correct More...
 
bool flagError
 flagError use this flag if for you do not enought More...
 
QTimer * timerFormula
 timerFormula timer for check formula More...
 
QPushButton * ok_Button
 ok_Button button ok More...
 
QPushButton * apply_Button
 apply_Button button apply More...
 
QDoubleSpinBox * spinBoxAngle
 spinBoxAngle spinbox for angle More...
 
QPlainTextEdit * plainTextEditFormula
 plainTextEditFormula formula More...
 
QLabel * labelResultCalculation
 labelResultCalculation label with result of calculation More...
 
QLabel * labelEditNamePoint
 labelEditNamePoint label used when need show wrong name of point More...
 
QLabel * labelEditFormula
 labelEditFormula label used when need show wrong formula More...
 
const QColor okColor
 
const QColor errorColor
 
VAbstractToolassociatedTool
 associatedTool vdrawtool associated with opened dialog. More...
 
quint32 toolId
 
bool prepare
 prepare show if we prepare. Show dialog after finish working with visual part of tool More...
 
QString pointName
 pointName name of point More...
 
qint32 number
 number number of handled objects More...
 
QPointer< Visualizationvis
 

Detailed Description

The DialogVariables class show dialog increments. Tables of all variables in program will be here.

Definition at line 72 of file dialogvariables.h.

Constructor & Destructor Documentation

◆ DialogVariables()

◆ ~DialogVariables()

DialogVariables::~DialogVariables ( )
virtual

Definition at line 177 of file dialogvariables.cpp.

References ui.

Member Function Documentation

◆ addCell()

void DialogVariables::addCell ( QTableWidget *  table,
const QString &  text,
int  row,
int  column,
int  aligment,
bool  ok = true 
)
private

Definition at line 336 of file dialogvariables.cpp.

References SCASSERT.

Referenced by fillCustomVariables().

◆ addCustomVariable

void DialogVariables::addCustomVariable ( )
privateslot

clickedToolButtonAdd create new row in table

Definition at line 621 of file dialogvariables.cpp.

References VPattern::addEmptyCustomVariable(), VPattern::addEmptyCustomVariableAfter(), doc, getCustomVariableName(), hasChanges, localUpdateTree(), and ui.

Referenced by DialogVariables().

◆ changeEvent()

void DialogVariables::changeEvent ( QEvent *  event)
protectedvirtual

Definition at line 884 of file dialogvariables.cpp.

References FullUpdateFromFile(), and ui.

◆ clearCustomVariableName()

QString DialogVariables::clearCustomVariableName ( const QString &  name) const
private

Definition at line 372 of file dialogvariables.cpp.

References CustomIncrSign.

Referenced by showCustomVariableDetails().

◆ closeEvent()

void DialogVariables::closeEvent ( QCloseEvent *  event)
protectedvirtual

closeEvent handle when dialog cloded

Parameters
eventevent

Reimplemented from DialogTool.

Definition at line 870 of file dialogvariables.cpp.

References DialogTool::DialogClosed(), refreshPattern(), ui, and updateProperties().

◆ enablePieces()

void DialogVariables::enablePieces ( bool  enabled)
private

Definition at line 479 of file dialogvariables.cpp.

References setMoveControls(), and ui.

Referenced by removeCustomVariable(), and showCustomVariableDetails().

◆ evalVariableFormula()

bool DialogVariables::evalVariableFormula ( const QString &  formula,
bool  fromUser,
VContainer data,
QLabel *  label 
)
private

◆ eventFilter()

bool DialogVariables::eventFilter ( QObject *  object,
QEvent *  event 
)
protectedvirtual

Reimplemented from DialogTool.

Definition at line 897 of file dialogvariables.cpp.

References DialogTool::eventFilter(), and qApp.

◆ fillArcsRadiuses()

void DialogVariables::fillArcsRadiuses ( )
private

Definition at line 298 of file dialogvariables.cpp.

References VContainer::arcRadiusesData(), data, fillTable(), and ui.

Referenced by DialogVariables(), and FullUpdateFromFile().

◆ fillControlPointLengths()

void DialogVariables::fillControlPointLengths ( )
private

Definition at line 292 of file dialogvariables.cpp.

References VContainer::controlPointLengthsData(), data, fillTable(), and ui.

Referenced by DialogVariables(), and FullUpdateFromFile().

◆ fillCurveAngles()

void DialogVariables::fillCurveAngles ( )
private

Definition at line 304 of file dialogvariables.cpp.

References VContainer::curveAnglesData(), data, fillTable(), and ui.

Referenced by DialogVariables(), and FullUpdateFromFile().

◆ fillCurveLengths()

void DialogVariables::fillCurveLengths ( )
private

FillLengthSplines fill data for table of splines lengths.

Definition at line 286 of file dialogvariables.cpp.

References VContainer::curveLengthsData(), data, fillTable(), and ui.

Referenced by DialogVariables(), and FullUpdateFromFile().

◆ fillCustomVariables()

void DialogVariables::fillCustomVariables ( bool  freshCall = false)
private

fillCustomVariables fill data for variables table

Definition at line 186 of file dialogvariables.cpp.

References addCell(), data, qApp, ui, and VContainer::variablesData().

Referenced by DialogVariables(), FullUpdateFromFile(), and localUpdateTree().

◆ fillLineAngles()

void DialogVariables::fillLineAngles ( )
private

Definition at line 277 of file dialogvariables.cpp.

References data, fillTable(), VContainer::lineAnglesData(), and ui.

Referenced by DialogVariables(), and FullUpdateFromFile().

◆ fillLineLengths()

void DialogVariables::fillLineLengths ( )
private

FillLengthLines fill data for table of lines lengths.

Definition at line 271 of file dialogvariables.cpp.

References data, fillTable(), VContainer::lineLengthsData(), and ui.

Referenced by DialogVariables(), and FullUpdateFromFile().

◆ fillTable()

template<typename T >
void DialogVariables::fillTable ( const QMap< QString, T > &  varTable,
QTableWidget *  table 
)
private

◆ filterVariables

void DialogVariables::filterVariables ( const QString &  filterString)
privateslot

Definition at line 1018 of file dialogvariables.cpp.

References isFiltered, tableList, and ui.

Referenced by DialogVariables().

◆ FullUpdateFromFile

void DialogVariables::FullUpdateFromFile ( )
privateslot

FullUpdateFromFile update information in tables form file.

Definition at line 574 of file dialogvariables.cpp.

References fillArcsRadiuses(), fillControlPointLengths(), fillCurveAngles(), fillCurveLengths(), fillCustomVariables(), fillLineAngles(), fillLineLengths(), hasChanges, and ui.

Referenced by changeEvent(), and DialogVariables().

◆ Fx

void DialogVariables::Fx ( )
privateslot

◆ getCustomVariableName()

QString DialogVariables::getCustomVariableName ( ) const
private

◆ localUpdateTree()

◆ moveDown

void DialogVariables::moveDown ( )
privateslot

Definition at line 695 of file dialogvariables.cpp.

References doc, hasChanges, localUpdateTree(), VPattern::MoveDownIncrement(), and ui.

Referenced by DialogVariables().

◆ moveUp

void DialogVariables::moveUp ( )
privateslot

Definition at line 676 of file dialogvariables.cpp.

References doc, hasChanges, localUpdateTree(), VPattern::MoveUpIncrement(), and ui.

Referenced by DialogVariables().

◆ refreshPattern

void DialogVariables::refreshPattern ( )
privateslot

◆ removeCustomVariable

void DialogVariables::removeCustomVariable ( )
privateslot

clickedToolButtonRemove remove one row from table

Definition at line 650 of file dialogvariables.cpp.

References doc, enablePieces(), hasChanges, localUpdateTree(), VPattern::removeCustomVariable(), and ui.

Referenced by DialogVariables().

◆ renameCache()

void DialogVariables::renameCache ( const QString &  name,
const QString &  newName 
)
private

Definition at line 556 of file dialogvariables.cpp.

References renameList.

Referenced by saveCustomVariableName().

◆ resizeEvent()

void DialogVariables::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Definition at line 952 of file dialogvariables.cpp.

References DialogTool::isInitialized, and qApp.

◆ saveCustomVariableDescription

void DialogVariables::saveCustomVariableDescription ( )
privateslot

Definition at line 753 of file dialogvariables.cpp.

References doc, localUpdateTree(), VPattern::setIncrementDescription(), and ui.

Referenced by DialogVariables().

◆ saveCustomVariableFormula

void DialogVariables::saveCustomVariableFormula ( )
privateslot

◆ saveCustomVariableName

void DialogVariables::saveCustomVariableName ( const QString &  text)
privateslot

◆ setMoveControls()

void DialogVariables::setMoveControls ( )
private

Definition at line 432 of file dialogvariables.cpp.

References isFiltered, isSorted, SCASSERT, ui, and variableUsed().

Referenced by DialogVariables(), and enablePieces().

◆ showCustomVariableDetails

void DialogVariables::showCustomVariableDetails ( )
privateslot

◆ showEvent()

void DialogVariables::showEvent ( QShowEvent *  event)
protectedvirtual

showEvent handle when window show

Parameters
eventevent

Reimplemented from DialogTool.

Definition at line 927 of file dialogvariables.cpp.

References DialogTool::isInitialized, and qApp.

◆ showHeaderUnits()

void DialogVariables::showHeaderUnits ( QTableWidget *  table,
int  column,
const QString &  unit 
)
private

Definition at line 326 of file dialogvariables.cpp.

References SCASSERT.

Referenced by showUnits().

◆ showUnits()

void DialogVariables::showUnits ( )
private

Definition at line 310 of file dialogvariables.cpp.

References degreeSymbol, qApp, showHeaderUnits(), ui, and UnitsToStr().

Referenced by DialogVariables().

◆ updateProperties

void DialogVariables::updateProperties ( )
signal

Referenced by closeEvent().

◆ variableUsed()

bool DialogVariables::variableUsed ( const QString &  name) const
private

Definition at line 526 of file dialogvariables.cpp.

References doc, and VAbstractPattern::ListExpressions().

Referenced by setMoveControls().

Member Data Documentation

◆ data

◆ doc

◆ formulaBaseHeight

int DialogVariables::formulaBaseHeight
private

Definition at line 115 of file dialogvariables.h.

Referenced by DialogVariables().

◆ hasChanges

◆ isFiltered

bool DialogVariables::isFiltered
private

Definition at line 123 of file dialogvariables.h.

Referenced by DialogVariables(), filterVariables(), and setMoveControls().

◆ isSorted

bool DialogVariables::isSorted
private

Definition at line 122 of file dialogvariables.h.

Referenced by DialogVariables(), and setMoveControls().

◆ renameList

QVector<QPair<QString, QString> > DialogVariables::renameList
private

Definition at line 119 of file dialogvariables.h.

Referenced by refreshPattern(), and renameCache().

◆ tableList

QList<QSharedPointer<QTableWidget> > DialogVariables::tableList
private

Definition at line 121 of file dialogvariables.h.

Referenced by DialogVariables(), and filterVariables().

◆ ui


The documentation for this class was generated from the following files: