2014-05-30 10:32:40 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file dialogeditwrongformula.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 29 5, 2014
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2014-05-30 10:32:40 +02:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "dialogeditwrongformula.h"
|
|
|
|
#include "ui_dialogeditwrongformula.h"
|
2015-04-30 13:08:54 +02:00
|
|
|
#include "../../container/vcontainer.h"
|
2014-05-30 10:32:40 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2014-07-29 14:19:11 +02:00
|
|
|
DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
2014-08-29 11:19:11 +02:00
|
|
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogEditWrongFormula), formula(QString()), formulaBaseHeight(0),
|
2014-10-24 16:27:41 +02:00
|
|
|
checkZero(false), postfix(QString()), restoreCursor(false)
|
2014-05-30 10:32:40 +02:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2015-04-30 13:08:54 +02:00
|
|
|
InitVariables();
|
2014-06-19 13:43:02 +02:00
|
|
|
InitFormulaUI(ui);
|
2014-06-19 14:01:38 +02:00
|
|
|
this->formulaBaseHeight = ui->plainTextEditFormula->height();
|
2014-10-29 19:00:38 +01:00
|
|
|
ui->plainTextEditFormula->installEventFilter(this);
|
2014-05-30 10:32:40 +02:00
|
|
|
|
2014-05-30 16:52:12 +02:00
|
|
|
InitOkCancel(ui);
|
2014-05-30 10:32:40 +02:00
|
|
|
flagFormula = false;
|
|
|
|
CheckState();
|
|
|
|
|
|
|
|
connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEditWrongFormula::PutHere);
|
|
|
|
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEditWrongFormula::PutVal);
|
|
|
|
|
2014-06-19 11:29:56 +02:00
|
|
|
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogEditWrongFormula::FormulaChanged);
|
|
|
|
connect(ui->pushButtonGrowLength, &QPushButton::clicked, this, &DialogEditWrongFormula::DeployFormulaTextEdit);
|
2014-05-30 11:04:19 +02:00
|
|
|
|
|
|
|
//Disable Qt::WaitCursor
|
|
|
|
#ifndef QT_NO_CURSOR
|
2014-08-29 15:57:12 +02:00
|
|
|
if (QApplication::overrideCursor() != nullptr)
|
2014-08-29 11:19:11 +02:00
|
|
|
{
|
2014-08-29 15:57:12 +02:00
|
|
|
if (QApplication::overrideCursor()->shape() == Qt::WaitCursor)
|
|
|
|
{
|
|
|
|
restoreCursor = true;
|
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
}
|
2014-08-29 11:19:11 +02:00
|
|
|
}
|
2014-05-30 11:04:19 +02:00
|
|
|
#endif
|
2014-05-30 10:32:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogEditWrongFormula::~DialogEditWrongFormula()
|
|
|
|
{
|
2014-05-30 11:04:19 +02:00
|
|
|
#ifndef QT_NO_CURSOR
|
2014-08-29 11:19:11 +02:00
|
|
|
if (restoreCursor)
|
|
|
|
{
|
|
|
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
|
|
|
}
|
2014-05-30 11:04:19 +02:00
|
|
|
#endif
|
2014-05-30 10:32:40 +02:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::DialogAccepted()
|
|
|
|
{
|
2014-06-19 11:29:56 +02:00
|
|
|
formula = ui->plainTextEditFormula->toPlainText();
|
|
|
|
formula.replace("\n", " ");
|
2014-05-30 10:32:40 +02:00
|
|
|
emit DialogClosed(QDialog::Accepted);
|
|
|
|
accepted();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::DialogRejected()
|
|
|
|
{
|
|
|
|
emit DialogClosed(QDialog::Rejected);
|
|
|
|
rejected();
|
|
|
|
}
|
|
|
|
|
2014-06-19 11:29:56 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::DeployFormulaTextEdit()
|
|
|
|
{
|
|
|
|
DeployFormula(ui->plainTextEditFormula, ui->pushButtonGrowLength, formulaBaseHeight);
|
|
|
|
}
|
|
|
|
|
2014-08-11 16:41:17 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::EvalFormula()
|
|
|
|
{
|
|
|
|
SCASSERT(plainTextEditFormula != nullptr);
|
|
|
|
SCASSERT(labelResultCalculation != nullptr);
|
2014-09-20 19:10:05 +02:00
|
|
|
Eval(plainTextEditFormula->toPlainText(), flagFormula, labelResultCalculation, postfix, checkZero);
|
2014-08-11 16:41:17 +02:00
|
|
|
}
|
|
|
|
|
2015-04-30 13:08:54 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief ValChenged show description when current variable changed
|
|
|
|
* @param row number of row
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::ValChenged(int row)
|
|
|
|
{
|
|
|
|
if (ui->listWidget->count() == 0)
|
|
|
|
{
|
|
|
|
ui->labelDescription->setText("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QListWidgetItem *item = ui->listWidget->item( row );
|
|
|
|
if (ui->radioButtonSizeGrowth->isChecked())
|
|
|
|
{
|
|
|
|
if (item->text()==data->HeightName())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->height()).arg(tr("Height"));
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
}
|
|
|
|
if (item->text()==data->SizeName())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size"));
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonStandardTable->isChecked())
|
|
|
|
{
|
2015-06-11 12:15:57 +02:00
|
|
|
const QString name = qApp->TrVars()->VarFromUser(item->text());
|
2015-06-02 15:56:49 +02:00
|
|
|
const QSharedPointer<VMeasurement> stable = data->GetVariable<VMeasurement>(name);
|
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(name))
|
|
|
|
.arg(stable->GetGuiText());
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonIncrements->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(item->text());
|
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetTableValue(item->text()))
|
|
|
|
.arg(incr->GetDescription());
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonLengthLine->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VLengthLine>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Line length"));
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonLengthArc->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VArcLength>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Arc length"));
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonLengthSpline->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VSplineLength>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Curve length"));
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonAngleLine->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VLineAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Line Angle"));
|
2015-04-30 13:08:54 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
2015-05-31 11:17:09 +02:00
|
|
|
if (ui->radioButtonRadiusesArcs->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VArcRadius>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Arc radius"));
|
2015-05-31 11:17:09 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
2015-06-02 15:53:19 +02:00
|
|
|
if (ui->radioButtonAnglesArcs->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VArcAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Arc angle"));
|
2015-06-02 15:53:19 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ui->radioButtonAnglesCurves->isChecked())
|
|
|
|
{
|
2015-06-02 15:56:49 +02:00
|
|
|
const QString desc = QString("%1(%2) - %3").arg(item->text())
|
2015-06-11 12:15:57 +02:00
|
|
|
.arg(*data->GetVariable<VCurveAngle>(qApp->TrVars()->VarFromUser(item->text()))->GetValue())
|
|
|
|
.arg(tr("Curve angle"));
|
2015-06-02 15:53:19 +02:00
|
|
|
ui->labelDescription->setText(desc);
|
|
|
|
return;
|
|
|
|
}
|
2015-04-30 13:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief SizeHeight show in list base variables
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::SizeHeight()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
|
|
|
|
ui->listWidget->blockSignals(true);
|
|
|
|
ui->listWidget->clear();
|
|
|
|
|
|
|
|
{
|
|
|
|
QListWidgetItem *item = new QListWidgetItem(data->HeightName());
|
|
|
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
|
|
ui->listWidget->addItem(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
QListWidgetItem *item = new QListWidgetItem(data->SizeName());
|
|
|
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
|
|
ui->listWidget->addItem(item);
|
|
|
|
|
|
|
|
ui->listWidget->blockSignals(false);
|
|
|
|
ui->listWidget->setCurrentRow (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief PutHere put variable into edit
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::PutHere()
|
|
|
|
{
|
|
|
|
const QListWidgetItem *item = ui->listWidget->currentItem();
|
|
|
|
if (item != nullptr)
|
|
|
|
{
|
|
|
|
QTextCursor cursor = ui->plainTextEditFormula->textCursor();
|
|
|
|
cursor.insertText(item->text());
|
|
|
|
ui->plainTextEditFormula->setTextCursor(cursor);
|
|
|
|
ui->plainTextEditFormula->setFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief PutVal put variable into edit
|
|
|
|
* @param item chosen item of list widget
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::PutVal(QListWidgetItem *item)
|
|
|
|
{
|
|
|
|
SCASSERT(item != nullptr);
|
|
|
|
QTextCursor cursor = ui->plainTextEditFormula->textCursor();
|
|
|
|
cursor.insertText(item->text());
|
|
|
|
ui->plainTextEditFormula->setTextCursor(cursor);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief Measurements show in list measurements
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::Measurements()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(true);
|
|
|
|
ShowVariable(data->DataMeasurements());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief LengthLines show in list lengths of lines variables
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::LengthLines()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataLengthLines());
|
|
|
|
}
|
|
|
|
|
2015-05-31 11:17:09 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::RadiusArcs()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataRadiusesArcs());
|
|
|
|
}
|
|
|
|
|
2015-06-02 15:53:19 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::AnglesArcs()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataAnglesArcs());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::AnglesCurves()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataAnglesCurves());
|
|
|
|
}
|
|
|
|
|
2015-04-30 13:08:54 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief LengthArcs show in list lengths of arcs variables
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::LengthArcs()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataLengthArcs());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief LengthCurves show in list lengths of curves variables
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::LengthCurves()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataLengthSplines());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::AngleLines()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataAngleLines());
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief Increments show in list increment variables
|
|
|
|
*/
|
|
|
|
void DialogEditWrongFormula::Increments()
|
|
|
|
{
|
|
|
|
ui->checkBoxHideEmpty->setEnabled(false);
|
|
|
|
ShowVariable(data->DataIncrements());
|
|
|
|
}
|
|
|
|
|
2014-05-30 10:32:40 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::CheckState()
|
|
|
|
{
|
2014-05-30 21:56:05 +02:00
|
|
|
SCASSERT(bOk != nullptr);
|
2014-05-30 10:32:40 +02:00
|
|
|
bOk->setEnabled(flagFormula);
|
|
|
|
}
|
|
|
|
|
2014-11-22 19:37:59 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
|
|
|
ui->plainTextEditFormula->blockSignals(true);
|
|
|
|
DialogTool::closeEvent(event);
|
|
|
|
}
|
|
|
|
|
2014-05-30 10:32:40 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-02-03 11:17:04 +01:00
|
|
|
void DialogEditWrongFormula::SetFormula(const QString &value)
|
2014-05-30 10:32:40 +02:00
|
|
|
{
|
2015-06-11 12:15:57 +02:00
|
|
|
formula = qApp->TrVars()->FormulaToUser(value);
|
2014-06-19 11:29:56 +02:00
|
|
|
// increase height if needed. TODO : see if I can get the max number of caracters in one line
|
|
|
|
// of this PlainTextEdit to change 80 to this value
|
|
|
|
if (formula.length() > 80)
|
|
|
|
{
|
|
|
|
this->DeployFormulaTextEdit();
|
|
|
|
}
|
|
|
|
ui->plainTextEditFormula->setPlainText(formula);
|
2014-10-29 14:40:56 +01:00
|
|
|
MoveCursorToEnd(ui->plainTextEditFormula);
|
2014-05-30 10:32:40 +02:00
|
|
|
}
|
|
|
|
|
2014-08-29 11:19:11 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::setCheckZero(bool value)
|
|
|
|
{
|
|
|
|
checkZero = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::setPostfix(const QString &value)
|
|
|
|
{
|
|
|
|
postfix = value;
|
|
|
|
}
|
|
|
|
|
2014-05-30 10:32:40 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-02-03 11:17:04 +01:00
|
|
|
QString DialogEditWrongFormula::GetFormula() const
|
2014-05-30 10:32:40 +02:00
|
|
|
{
|
2015-06-11 12:15:57 +02:00
|
|
|
return qApp->TrVars()->FormulaFromUser(formula);
|
2014-05-30 10:32:40 +02:00
|
|
|
}
|
2015-04-30 13:08:54 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogEditWrongFormula::InitVariables()
|
|
|
|
{
|
|
|
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEditWrongFormula::ValChenged);
|
|
|
|
|
|
|
|
if (qApp->patternType() == MeasurementsType::Standard)
|
|
|
|
{
|
|
|
|
SizeHeight();
|
|
|
|
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogEditWrongFormula::SizeHeight);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->radioButtonSizeGrowth->setEnabled(false);
|
|
|
|
ui->radioButtonStandardTable->setChecked(true);
|
|
|
|
Measurements();
|
|
|
|
}
|
|
|
|
connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogEditWrongFormula::Measurements);
|
|
|
|
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEditWrongFormula::Increments);
|
|
|
|
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthLines);
|
|
|
|
connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthArcs);
|
|
|
|
connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEditWrongFormula::LengthCurves);
|
|
|
|
connect(ui->radioButtonAngleLine, &QRadioButton::clicked, this, &DialogEditWrongFormula::AngleLines);
|
|
|
|
connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements);
|
2015-05-31 11:17:09 +02:00
|
|
|
connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs);
|
2015-06-02 15:53:19 +02:00
|
|
|
connect(ui->radioButtonAnglesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesArcs);
|
|
|
|
connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves);
|
2015-04-30 13:08:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
|
|
* @brief ShowVariable show variables in list
|
|
|
|
* @param var container with variables
|
|
|
|
*/
|
|
|
|
template <class key, class val>
|
|
|
|
void DialogEditWrongFormula::ShowVariable(const QMap<key, val> var)
|
|
|
|
{
|
|
|
|
ui->listWidget->blockSignals(true);
|
|
|
|
ui->listWidget->clear();
|
|
|
|
ui->labelDescription->setText("");
|
|
|
|
|
|
|
|
QMapIterator<key, val> iMap(var);
|
|
|
|
while (iMap.hasNext())
|
|
|
|
{
|
|
|
|
iMap.next();
|
|
|
|
if (ui->checkBoxHideEmpty->isEnabled() && ui->checkBoxHideEmpty->isChecked() && iMap.value()->IsNotUsed())
|
|
|
|
{
|
|
|
|
continue; //skip this measurement
|
|
|
|
}
|
|
|
|
if (iMap.value()->Filter(toolId) == false)
|
|
|
|
{// If we create this variable don't show
|
|
|
|
QListWidgetItem *item = new QListWidgetItem(iMap.key());
|
|
|
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
|
|
ui->listWidget->addItem(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ui->listWidget->blockSignals(false);
|
|
|
|
ui->listWidget->setCurrentRow (0);
|
|
|
|
}
|