F(x) button for tool Point intersect line and axis.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-04-29 21:15:26 +03:00
parent 483b9c28ba
commit 8540359444
3 changed files with 144 additions and 309 deletions

View File

@ -34,6 +34,8 @@
#include "../../visualization/vistoollineintersectaxis.h" #include "../../visualization/vistoollineintersectaxis.h"
#include "../../widgets/vmaingraphicsscene.h" #include "../../widgets/vmaingraphicsscene.h"
#include "../../tools/vabstracttool.h" #include "../../tools/vabstracttool.h"
#include "dialogeditwrongformula.h"
#include <QTimer> #include <QTimer>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -42,7 +44,6 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
formulaBaseHeightAngle(0), line(nullptr) formulaBaseHeightAngle(0), 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;
@ -59,8 +60,7 @@ DialogLineIntersectAxis::DialogLineIntersectAxis(const VContainer *data, const q
FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics()); FillComboBoxTypeLine(ui->comboBoxLineType, VAbstractTool::LineStylesPics());
FillComboBoxLineColors(ui->comboBoxLineColor); FillComboBoxLineColors(ui->comboBoxLineColor);
connect(ui->toolButtonPutHereAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::PutAngle); connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::FXAngle);
connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogLineIntersectAxis::PutVal);
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersectAxis::NamePointChanged); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersectAxis::NamePointChanged);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogLineIntersectAxis::AngleTextChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogLineIntersectAxis::AngleTextChanged);
connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::DeployAngleTextEdit); connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogLineIntersectAxis::DeployAngleTextEdit);
@ -260,12 +260,6 @@ void DialogLineIntersectAxis::ChosenObject(quint32 id, const SceneObject &type)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::PutAngle()
{
PutValHere(ui->plainTextEditFormula, ui->listWidget);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::EvalAngle() void DialogLineIntersectAxis::EvalAngle()
{ {
@ -309,6 +303,19 @@ void DialogLineIntersectAxis::PointNameChanged()
CheckState(); CheckState();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::FXAngle()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit angle"));
dialog->SetFormula(GetAngle());
if (dialog->exec() == QDialog::Accepted)
{
SetAngle(dialog->GetFormula());
}
delete dialog;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLineIntersectAxis::ShowVisualization() void DialogLineIntersectAxis::ShowVisualization()
{ {

View File

@ -69,11 +69,11 @@ public:
virtual void ShowDialog(bool click); virtual void ShowDialog(bool click);
public slots: public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type); virtual void ChosenObject(quint32 id, const SceneObject &type);
void PutAngle();
void EvalAngle(); void EvalAngle();
void AngleTextChanged(); void AngleTextChanged();
void DeployAngleTextEdit(); void DeployAngleTextEdit();
virtual void PointNameChanged(); virtual void PointNameChanged();
void FXAngle();
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>457</width> <width>457</width>
<height>565</height> <height>317</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -84,13 +84,13 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHereAngle"> <widget class="QToolButton" name="toolButtonExprAngle">
<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>
@ -197,296 +197,134 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QFormLayout" name="formLayout">
<item> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QLabel" name="labelAxisPoint">
<item> <property name="sizePolicy">
<layout class="QVBoxLayout" name="verticalLayout_3"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<item> <horstretch>0</horstretch>
<layout class="QFormLayout" name="formLayout"> <verstretch>0</verstretch>
<item row="0" column="0"> </sizepolicy>
<widget class="QLabel" name="labelAxisPoint"> </property>
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <string>Axis point</string>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> </widget>
</sizepolicy>
</property>
<property name="text">
<string>Axis point</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxAxisPoint">
<property name="toolTip">
<string>Axis Point</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelFirstLinePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>First line point</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxFirstLinePoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSecondLinePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Second line point</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxSecondLinePoint">
<property name="toolTip">
<string>Second point of line</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point label</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Type of line</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxLineType">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Show line from first point to this point</string>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Line color</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxLineColor"/>
</item>
</layout>
</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>
<item> <item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QComboBox" name="comboBoxAxisPoint">
<item> <property name="toolTip">
<widget class="QCheckBox" name="checkBoxHideEmpty"> <string>Axis Point</string>
<property name="text"> </property>
<string>Hide empty measurements</string> </widget>
</property> </item>
<property name="checked"> <item row="1" column="0">
<bool>true</bool> <widget class="QLabel" name="labelFirstLinePoint">
</property> <property name="sizePolicy">
</widget> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
</item> <horstretch>0</horstretch>
<item> <verstretch>0</verstretch>
<widget class="QListWidget" name="listWidget"> </sizepolicy>
<property name="toolTip"> </property>
<string>Variables</string> <property name="text">
</property> <string>First line point</string>
</widget> </property>
</item> </widget>
</layout> </item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxFirstLinePoint">
<property name="toolTip">
<string>First point of line</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelSecondLinePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Second line point</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxSecondLinePoint">
<property name="toolTip">
<string>Second point of line</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Point label</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditNamePoint">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Type of line</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBoxLineType">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>110</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Show line from first point to this point</string>
</property>
<property name="iconSize">
<size>
<width>80</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Line color</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboBoxLineColor"/>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</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">
@ -501,22 +339,12 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>plainTextEditFormula</tabstop> <tabstop>plainTextEditFormula</tabstop>
<tabstop>toolButtonPutHereAngle</tabstop>
<tabstop>pushButtonGrowLengthAngle</tabstop> <tabstop>pushButtonGrowLengthAngle</tabstop>
<tabstop>comboBoxAxisPoint</tabstop> <tabstop>comboBoxAxisPoint</tabstop>
<tabstop>comboBoxFirstLinePoint</tabstop> <tabstop>comboBoxFirstLinePoint</tabstop>
<tabstop>comboBoxSecondLinePoint</tabstop> <tabstop>comboBoxSecondLinePoint</tabstop>
<tabstop>lineEditNamePoint</tabstop> <tabstop>lineEditNamePoint</tabstop>
<tabstop>comboBoxLineType</tabstop> <tabstop>comboBoxLineType</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>