Fixed bug with dialog of arc.

--HG--
branch : develop
This commit is contained in:
dismine 2013-10-09 21:11:25 +03:00
parent b791ac648d
commit 7b56218e09
6 changed files with 19 additions and 13 deletions

View File

@ -64,7 +64,7 @@ void VContainer::setData(const VContainer &data){
standartTable = *data.DataStandartTable(); standartTable = *data.DataStandartTable();
incrementTable = *data.DataIncrementTable(); incrementTable = *data.DataIncrementTable();
lengthLines = *data.DataLengthLines(); lengthLines = *data.DataLengthLines();
lineAngles = *data.DataLengthArcs(); lineAngles = *data.DataLineAngles();
splines = *data.DataSplines(); splines = *data.DataSplines();
modelingSplines = *data.DataModelingSplines(); modelingSplines = *data.DataModelingSplines();
lengthSplines = *data.DataLengthSplines(); lengthSplines = *data.DataLengthSplines();

View File

@ -63,7 +63,7 @@ DialogArc::DialogArc(const VContainer *data, Draw::Draws mode, QWidget *parent)
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable); connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments); connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines); connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines);
connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineArcs); connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles);
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius); connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1); connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);
@ -173,19 +173,22 @@ void DialogArc::PutF2(){
PutValHere(ui->lineEditF2, ui->listWidget); PutValHere(ui->lineEditF2, ui->listWidget);
} }
void DialogArc::LineArcs(){ void DialogArc::LineAngles(){
ShowLineArcs(); ShowLineAngles();
} }
void DialogArc::RadiusChanged(){ void DialogArc::RadiusChanged(){
labelEditFormula = ui->labelEditRadius;
ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius); ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius);
} }
void DialogArc::F1Changed(){ void DialogArc::F1Changed(){
labelEditFormula = ui->labelEditF1;
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1); ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
} }
void DialogArc::F2Changed(){ void DialogArc::F2Changed(){
labelEditFormula = ui->labelEditF2;
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2); ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
} }
@ -209,12 +212,13 @@ void DialogArc::EvalF2(){
Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2); Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2);
} }
void DialogArc::ShowLineArcs(){ void DialogArc::ShowLineAngles(){
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ui->listWidget->clear(); ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QHash<QString, qreal> *lineArcsTable = data->DataLineAngles(); const QHash<QString, qreal> *lineAnglesTable = data->DataLineAngles();
QHashIterator<QString, qreal> i(*lineArcsTable); Q_CHECK_PTR(lineAnglesTable);
QHashIterator<QString, qreal> i(*lineAnglesTable);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
QListWidgetItem *item = new QListWidgetItem(i.key()); QListWidgetItem *item = new QListWidgetItem(i.key());

View File

@ -53,7 +53,7 @@ public slots:
void PutRadius(); void PutRadius();
void PutF1(); void PutF1();
void PutF2(); void PutF2();
void LineArcs(); void LineAngles();
void RadiusChanged(); void RadiusChanged();
void F1Changed(); void F1Changed();
void F2Changed(); void F2Changed();
@ -75,7 +75,7 @@ private:
void EvalRadius(); void EvalRadius();
void EvalF1(); void EvalF1();
void EvalF2(); void EvalF2();
void ShowLineArcs(); void ShowLineAngles();
}; };
#endif // DIALOGARC_H #endif // DIALOGARC_H

View File

@ -482,7 +482,7 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthArc"> <widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of arcs</string>
@ -492,10 +492,10 @@
<item> <item>
<widget class="QRadioButton" name="radioButtonLengthSpline"> <widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Length of arcs</string> <string>Length of curves</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -47,6 +47,8 @@ protected:
template <typename Dialog, typename Tool> template <typename Dialog, typename Tool>
void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event, void ContextMenu(QSharedPointer<Dialog> &dialog, Tool *tool, QGraphicsSceneContextMenuEvent *event,
bool showRemove = true){ bool showRemove = true){
Q_CHECK_PTR(tool);
Q_CHECK_PTR(event);
if(!ignoreContextMenuEvent){ if(!ignoreContextMenuEvent){
QMenu menu; QMenu menu;
QAction *actionOption = menu.addAction(tr("Options")); QAction *actionOption = menu.addAction(tr("Options"));

View File

@ -44,9 +44,9 @@ void VToolArc::setDialog(){
if(!dialogArc.isNull()){ if(!dialogArc.isNull()){
VArc arc = VAbstractTool::data.GetArc(id); VArc arc = VAbstractTool::data.GetArc(id);
dialogArc->SetCenter(arc.GetCenter()); dialogArc->SetCenter(arc.GetCenter());
dialogArc->SetRadius(arc.GetFormulaRadius());
dialogArc->SetF1(arc.GetFormulaF1()); dialogArc->SetF1(arc.GetFormulaF1());
dialogArc->SetF2(arc.GetFormulaF2()); dialogArc->SetF2(arc.GetFormulaF2());
dialogArc->SetRadius(arc.GetFormulaRadius());
} }
} }