F(x) buttons for tool Arc.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-04-29 20:32:27 +03:00
parent 7e4aea059f
commit 1f3fce60de
3 changed files with 84 additions and 283 deletions

View File

@ -36,6 +36,7 @@
#include "../../container/vcontainer.h" #include "../../container/vcontainer.h"
#include "../../libs/ifc/xml/vdomdocument.h" #include "../../libs/ifc/xml/vdomdocument.h"
#include "../../visualization/vistoolarc.h" #include "../../visualization/vistoolarc.h"
#include "dialogeditwrongformula.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -51,8 +52,6 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui);
plainTextEditFormula = ui->plainTextEditFormula; plainTextEditFormula = ui->plainTextEditFormula;
this->formulaBaseHeight = ui->plainTextEditFormula->height(); this->formulaBaseHeight = ui->plainTextEditFormula->height();
this->formulaBaseHeightF1 = ui->plainTextEditF1->height(); this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
@ -78,9 +77,9 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
CheckState(); CheckState();
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius); connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, &DialogArc::FXRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1); connect(ui->toolButtonExprF1, &QPushButton::clicked, this, &DialogArc::FXF1);
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2); connect(ui->toolButtonExprF2, &QPushButton::clicked, this, &DialogArc::FXF2);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed); connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
@ -259,43 +258,6 @@ void DialogArc::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief PutRadius put variable into formula of radius
*/
void DialogArc::PutRadius()
{
PutValHere(ui->plainTextEditFormula, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief PutF1 put variable into formula of first angle
*/
void DialogArc::PutF1()
{
PutValHere(ui->plainTextEditF1, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief PutF2 put variable into formula of second angle
*/
void DialogArc::PutF2()
{
PutValHere(ui->plainTextEditF2, ui->listWidget);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief LineAngles show variable angles of lines
*/
// cppcheck-suppress unusedFunction
void DialogArc::LineAngles()
{
ShowLineAngles();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief RadiusChanged after change formula of radius calculate value and show result * @brief RadiusChanged after change formula of radius calculate value and show result
@ -329,6 +291,45 @@ void DialogArc::F2Changed()
ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2); ValFormulaChanged(flagF2, ui->plainTextEditF2, timerF2);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::FXRadius()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit radius"));
dialog->SetFormula(GetRadius());
if (dialog->exec() == QDialog::Accepted)
{
SetRadius(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::FXF1()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit first angle"));
dialog->SetFormula(GetF1());
if (dialog->exec() == QDialog::Accepted)
{
SetF1(dialog->GetFormula());
}
delete dialog;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::FXF2()
{
DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data, toolId, this);
dialog->setWindowTitle(tr("Edit second angle"));
dialog->SetFormula(GetF2());
if (dialog->exec() == QDialog::Accepted)
{
SetF2(dialog->GetFormula());
}
delete dialog;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief CheckState if all is right enable button ok * @brief CheckState if all is right enable button ok
@ -377,27 +378,6 @@ void DialogArc::EvalF()
CheckAngles(); CheckAngles();
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowLineAngles show varibles angles of lines
*/
void DialogArc::ShowLineAngles()
{
ui->listWidget->blockSignals(true);
ui->listWidget->clear();
ui->listWidget->blockSignals(false);
const QMap<QString, QSharedPointer<VLineAngle> > lineAnglesTable = data->DataAngleLines();
QMap<QString, QSharedPointer<VLineAngle> >::const_iterator i;
for (i = lineAnglesTable.constBegin(); i != lineAnglesTable.constEnd(); ++i)
{
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
ui->listWidget->addItem(item);
}
ui->listWidget->setCurrentRow (0);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogArc::CheckAngles() void DialogArc::CheckAngles()
{ {

View File

@ -70,14 +70,13 @@ public slots:
void DeployFormulaTextEdit(); void DeployFormulaTextEdit();
void DeployF1TextEdit(); void DeployF1TextEdit();
void DeployF2TextEdit(); void DeployF2TextEdit();
void PutRadius();
void PutF1();
void PutF2();
// cppcheck-suppress unusedFunction
void LineAngles();
void RadiusChanged(); void RadiusChanged();
void F1Changed(); void F1Changed();
void F2Changed(); void F2Changed();
void FXRadius();
void FXF1();
void FXF2();
protected: protected:
virtual void CheckState(); virtual void CheckState();
virtual void ShowVisualization(); virtual void ShowVisualization();
@ -131,7 +130,6 @@ private:
void EvalRadius(); void EvalRadius();
void EvalF(); void EvalF();
void ShowLineAngles();
void CheckAngles(); void CheckAngles();
}; };

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>425</width> <width>425</width>
<height>577</height> <height>329</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="toolButtonPutHereRadius"> <widget class="QToolButton" name="toolButtonExprRadius">
<property name="toolTip">
<string>Insert variable into the 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>
@ -265,16 +262,13 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHereF1"> <widget class="QToolButton" name="toolButtonExprF1">
<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>
@ -443,16 +437,13 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButtonPutHereF2"> <widget class="QToolButton" name="toolButtonExprF2">
<property name="toolTip">
<string>Insert marked variable into formula</string>
</property>
<property name="text"> <property name="text">
<string notr="true">...</string> <string>...</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>
@ -555,12 +546,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="0" column="0">
@ -595,156 +580,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="label_8">
<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</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">
@ -759,23 +594,11 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>plainTextEditFormula</tabstop> <tabstop>plainTextEditFormula</tabstop>
<tabstop>toolButtonPutHereRadius</tabstop>
<tabstop>pushButtonGrowLength</tabstop> <tabstop>pushButtonGrowLength</tabstop>
<tabstop>plainTextEditF1</tabstop> <tabstop>plainTextEditF1</tabstop>
<tabstop>toolButtonPutHereF1</tabstop>
<tabstop>pushButtonGrowLengthF1</tabstop> <tabstop>pushButtonGrowLengthF1</tabstop>
<tabstop>plainTextEditF2</tabstop> <tabstop>plainTextEditF2</tabstop>
<tabstop>toolButtonPutHereF2</tabstop>
<tabstop>pushButtonGrowLengthF2</tabstop> <tabstop>pushButtonGrowLengthF2</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>comboBoxBasePoint</tabstop> <tabstop>comboBoxBasePoint</tabstop>
<tabstop>comboBoxColor</tabstop> <tabstop>comboBoxColor</tabstop>
</tabstops> </tabstops>