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 "../../libs/ifc/xml/vdomdocument.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);
InitVariables(ui);
plainTextEditFormula = ui->plainTextEditFormula;
this->formulaBaseHeight = ui->plainTextEditFormula->height();
this->formulaBaseHeightF1 = ui->plainTextEditF1->height();
@ -78,9 +77,9 @@ DialogArc::DialogArc(const VContainer *data, const quint32 &toolId, QWidget *par
CheckState();
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2);
connect(ui->toolButtonExprRadius, &QPushButton::clicked, this, &DialogArc::FXRadius);
connect(ui->toolButtonExprF1, &QPushButton::clicked, this, &DialogArc::FXF1);
connect(ui->toolButtonExprF2, &QPushButton::clicked, this, &DialogArc::FXF2);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogArc::RadiusChanged);
connect(ui->plainTextEditF1, &QPlainTextEdit::textChanged, this, &DialogArc::F1Changed);
@ -259,43 +258,6 @@ void DialogArc::closeEvent(QCloseEvent *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
@ -329,6 +291,45 @@ void DialogArc::F2Changed()
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
@ -377,27 +378,6 @@ void DialogArc::EvalF()
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()
{

View file

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

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>425</width>
<height>577</height>
<height>329</height>
</rect>
</property>
<property name="windowTitle">
@ -87,16 +87,13 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereRadius">
<property name="toolTip">
<string>Insert variable into the formula</string>
</property>
<widget class="QToolButton" name="toolButtonExprRadius">
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<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 name="iconSize">
<size>
@ -265,16 +262,13 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF1">
<property name="toolTip">
<string>Insert variable into formula</string>
</property>
<widget class="QToolButton" name="toolButtonExprF1">
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<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 name="iconSize">
<size>
@ -443,16 +437,13 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF2">
<property name="toolTip">
<string>Insert marked variable into formula</string>
</property>
<widget class="QToolButton" name="toolButtonExprF2">
<property name="text">
<string notr="true">...</string>
<string>...</string>
</property>
<property name="icon">
<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 name="iconSize">
<size>
@ -556,195 +547,39 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Center point</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>Select point of center of arc</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
</layout>
</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>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Center point</string>
</property>
</widget>
</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 row="0" column="1">
<widget class="QComboBox" name="comboBoxBasePoint">
<property name="toolTip">
<string>Select point of center of arc</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxColor"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
@ -759,23 +594,11 @@
</widget>
<tabstops>
<tabstop>plainTextEditFormula</tabstop>
<tabstop>toolButtonPutHereRadius</tabstop>
<tabstop>pushButtonGrowLength</tabstop>
<tabstop>plainTextEditF1</tabstop>
<tabstop>toolButtonPutHereF1</tabstop>
<tabstop>pushButtonGrowLengthF1</tabstop>
<tabstop>plainTextEditF2</tabstop>
<tabstop>toolButtonPutHereF2</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>comboBoxColor</tabstop>
</tabstops>