Merged in ValentinaZhuravska/valentina/feature (pull request #73)
Fixed problems in DialogDetail --HG-- branch : develop
This commit is contained in:
commit
ae1195df21
|
@ -117,16 +117,7 @@ void DialogDetail::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
EnableObjectGUI(true);
|
EnableObjectGUI(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CreateDetail().ContourPoints(data).size() < 3)
|
ValidObjects(DetailIsValid());
|
||||||
{
|
|
||||||
ValidObjects(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ValidObjects(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,31 +171,49 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(name);
|
bool canAddNewPoint = false;
|
||||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
|
||||||
VNodeDetail node(id, typeTool, typeNode, mx, my, reverse);
|
|
||||||
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
|
||||||
ui.listWidget->addItem(item);
|
|
||||||
ui.listWidget->setCurrentRow(ui.listWidget->count()-1);
|
|
||||||
|
|
||||||
ui.doubleSpinBoxBiasX->blockSignals(true);
|
if(ui.listWidget->count() == 0)
|
||||||
ui.doubleSpinBoxBiasY->blockSignals(true);
|
|
||||||
|
|
||||||
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
|
|
||||||
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));
|
|
||||||
if (node.getTypeTool() == Tool::NodePoint)
|
|
||||||
{
|
{
|
||||||
ui.checkBoxReverse->setChecked(false);
|
canAddNewPoint = true;
|
||||||
ui.checkBoxReverse->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui.checkBoxReverse->setEnabled(true);
|
const QString previousItemName = ui.listWidget->item(ui.listWidget->count()-1)->text();
|
||||||
ui.checkBoxReverse->setChecked(node.getReverse());
|
if(QString::compare(previousItemName, name) != 0)
|
||||||
|
{
|
||||||
|
canAddNewPoint = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.doubleSpinBoxBiasX->blockSignals(false);
|
if(canAddNewPoint)
|
||||||
ui.doubleSpinBoxBiasY->blockSignals(false);
|
{
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(name);
|
||||||
|
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||||
|
VNodeDetail node(id, typeTool, typeNode, mx, my, reverse);
|
||||||
|
item->setData(Qt::UserRole, QVariant::fromValue(node));
|
||||||
|
ui.listWidget->addItem(item);
|
||||||
|
ui.listWidget->setCurrentRow(ui.listWidget->count()-1);
|
||||||
|
|
||||||
|
ui.doubleSpinBoxBiasX->blockSignals(true);
|
||||||
|
ui.doubleSpinBoxBiasY->blockSignals(true);
|
||||||
|
|
||||||
|
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
|
||||||
|
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));
|
||||||
|
if (node.getTypeTool() == Tool::NodePoint)
|
||||||
|
{
|
||||||
|
ui.checkBoxReverse->setChecked(false);
|
||||||
|
ui.checkBoxReverse->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.checkBoxReverse->setEnabled(true);
|
||||||
|
ui.checkBoxReverse->setChecked(node.getReverse());
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.doubleSpinBoxBiasX->blockSignals(false);
|
||||||
|
ui.doubleSpinBoxBiasY->blockSignals(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -402,9 +411,56 @@ void DialogDetail::DeleteItem()
|
||||||
EnableObjectGUI(false);
|
EnableObjectGUI(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete ui.listWidget->item( ui.listWidget->currentRow() );
|
delete ui.listWidget->item(ui.listWidget->currentRow());
|
||||||
if (CreateDetail().ContourPoints(data).size() < 3 )
|
ValidObjects(DetailIsValid());
|
||||||
{
|
}
|
||||||
ValidObjects(false);
|
|
||||||
}
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogDetail::DetailIsValid() const
|
||||||
|
{
|
||||||
|
if (ui.listWidget->count() < 3)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (FirstPointEqualLast())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i=0, sz = ui.listWidget->count()-1; i<sz; ++i)
|
||||||
|
{
|
||||||
|
const QString previousRow = ui.listWidget->item(i)->text();
|
||||||
|
const QString nextRow = ui.listWidget->item(i+1)->text();
|
||||||
|
|
||||||
|
if (QString::compare(previousRow, nextRow) == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogDetail::FirstPointEqualLast() const
|
||||||
|
{
|
||||||
|
if (ui.listWidget->count() > 1)
|
||||||
|
{
|
||||||
|
const QString firstDetailPoint = ui.listWidget->item(0)->text();
|
||||||
|
const QString lastDetailPoint = ui.listWidget->item(ui.listWidget->count()-1)->text();
|
||||||
|
|
||||||
|
if (QString::compare(firstDetailPoint, lastDetailPoint) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,8 @@ private:
|
||||||
/** @brief closed keep option about equdistant (closed or not) */
|
/** @brief closed keep option about equdistant (closed or not) */
|
||||||
bool closed;
|
bool closed;
|
||||||
bool flagWidth;
|
bool flagWidth;
|
||||||
|
bool DetailIsValid() const;
|
||||||
|
bool FirstPointEqualLast() const;
|
||||||
|
|
||||||
void NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
|
void NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
|
||||||
qreal mx = 0, qreal my = 0, bool reverse = false);
|
qreal mx = 0, qreal my = 0, bool reverse = false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user