F(x) button for tool Point along perpendicular.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-04-29 21:19:57 +03:00
parent 8540359444
commit 09fd789659
3 changed files with 310 additions and 470 deletions

View File

@ -31,6 +31,7 @@
#include "../visualization/vistoolnormal.h" #include "../visualization/vistoolnormal.h"
#include "../widgets/vmaingraphicsscene.h" #include "../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h" #include "../../tools/vabstracttool.h"
#include "dialogeditwrongformula.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -43,7 +44,6 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge
line(nullptr) line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui);
InitFormulaUI(ui); InitFormulaUI(ui);
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel)); ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
labelEditNamePoint = ui->labelEditNamePoint; labelEditNamePoint = ui->labelEditNamePoint;
@ -61,8 +61,7 @@ DialogNormal::DialogNormal(const VContainer *data, const quint32 &toolId, QWidge
InitArrow(ui); InitArrow(ui);
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogNormal::FXLength);
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogNormal::FormulaTextChanged);
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit); connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogNormal::DeployFormulaTextEdit);
@ -99,6 +98,19 @@ void DialogNormal::PointNameChanged()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogNormal::FXLength()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit length"));
dialog->SetFormula(GetFormula());
if (dialog->exec() == QDialog::Accepted)
{
SetFormula(dialog->GetFormula());
}
delete dialog;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogNormal::ShowVisualization() void DialogNormal::ShowVisualization()
{ {

View File

@ -78,6 +78,7 @@ public slots:
*/ */
void FormulaTextChanged(); void FormulaTextChanged();
virtual void PointNameChanged(); virtual void PointNameChanged();
void FXLength();
protected: protected:
virtual void ShowVisualization(); virtual void ShowVisualization();
/** /**

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>517</width> <width>517</width>
<height>678</height> <height>428</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -87,16 +87,13 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHere"> <widget class="QToolButton" name="toolButtonExprLength">
<property name="toolTip">
<string>Insert variable into formula</string>
</property>
<property name="text"> <property name="text">
<string notr="true">...</string> <string notr="true">...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../share/resources/icon.qrc"> <iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset> <normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -199,10 +196,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="0" column="0">
@ -263,8 +256,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
@ -300,14 +291,14 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="2"> <item row="1" column="2">
<widget class="QToolButton" name="toolButtonArrowRightUp"> <widget class="QToolButton" name="toolButtonArrowRight">
<property name="text"> <property name="text">
<string notr="true">...</string> <string notr="true">...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../share/resources/icon.qrc"> <iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrowRightUp.png</normaloff>:/icon/32x32/arrowRightUp.png</iconset> <normaloff>:/icon/32x32/arrowRight.png</normaloff>:/icon/32x32/arrowRight.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -317,6 +308,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>56</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QToolButton" name="toolButtonArrowLeftUp"> <widget class="QToolButton" name="toolButtonArrowLeftUp">
<property name="text"> <property name="text">
@ -334,31 +347,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="2">
<widget class="QToolButton" name="toolButtonArrowLeft"> <widget class="QToolButton" name="toolButtonArrowRightUp">
<property name="text"> <property name="text">
<string notr="true">...</string> <string notr="true">...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../share/resources/icon.qrc"> <iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrowLeft.png</normaloff>:/icon/32x32/arrowLeft.png</iconset> <normaloff>:/icon/32x32/arrowRightUp.png</normaloff>:/icon/32x32/arrowRightUp.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="toolButtonArrowRight">
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrowRight.png</normaloff>:/icon/32x32/arrowRight.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -391,14 +387,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="0">
<widget class="QToolButton" name="toolButtonArrowDown"> <widget class="QToolButton" name="toolButtonArrowLeft">
<property name="text"> <property name="text">
<string notr="true">...</string> <string notr="true">...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../share/resources/icon.qrc"> <iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrowDown.png</normaloff>:/icon/32x32/arrowDown.png</iconset> <normaloff>:/icon/32x32/arrowLeft.png</normaloff>:/icon/32x32/arrowLeft.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -425,6 +421,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QToolButton" name="toolButtonArrowDown">
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrowDown.png</normaloff>:/icon/32x32/arrowDown.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QToolButton" name="toolButtonArrowRightDown"> <widget class="QToolButton" name="toolButtonArrowRightDown">
<property name="text"> <property name="text">
@ -442,36 +455,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAngle">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>56</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<double>-360.000000000000000</double>
</property>
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0"> <item row="0" column="0">
@ -518,156 +505,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Input data</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonSizeGrowth">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Size and height</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonStandardTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Measurements</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIncrements">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Increments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthLine">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of lines</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of arcs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Length of curves</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonAngleLine">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Angle of lines</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxHideEmpty">
<property name="text">
<string>Hide empty measurements</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="listWidget">
<property name="toolTip">
<string>Variables - Click twice to insert into formula</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
@ -682,7 +519,6 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>plainTextEditFormula</tabstop> <tabstop>plainTextEditFormula</tabstop>
<tabstop>toolButtonPutHere</tabstop>
<tabstop>pushButtonGrowLength</tabstop> <tabstop>pushButtonGrowLength</tabstop>
<tabstop>lineEditNamePoint</tabstop> <tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxFirstPoint</tabstop> <tabstop>comboBoxFirstPoint</tabstop>
@ -696,15 +532,6 @@
<tabstop>toolButtonArrowLeftDown</tabstop> <tabstop>toolButtonArrowLeftDown</tabstop>
<tabstop>toolButtonArrowLeft</tabstop> <tabstop>toolButtonArrowLeft</tabstop>
<tabstop>toolButtonArrowLeftUp</tabstop> <tabstop>toolButtonArrowLeftUp</tabstop>
<tabstop>radioButtonSizeGrowth</tabstop>
<tabstop>radioButtonStandardTable</tabstop>
<tabstop>radioButtonIncrements</tabstop>
<tabstop>radioButtonLengthLine</tabstop>
<tabstop>radioButtonLengthArc</tabstop>
<tabstop>radioButtonLengthSpline</tabstop>
<tabstop>radioButtonAngleLine</tabstop>
<tabstop>checkBoxHideEmpty</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
</tabstops> </tabstops>
<resources> <resources>