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);
|
||||
}
|
||||
|
||||
if (CreateDetail().ContourPoints(data).size() < 3)
|
||||
{
|
||||
ValidObjects(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ValidObjects(true);
|
||||
|
||||
}
|
||||
|
||||
ValidObjects(DetailIsValid());
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +171,23 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
|
|||
return;
|
||||
}
|
||||
|
||||
bool canAddNewPoint = false;
|
||||
|
||||
if(ui.listWidget->count() == 0)
|
||||
{
|
||||
canAddNewPoint = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString previousItemName = ui.listWidget->item(ui.listWidget->count()-1)->text();
|
||||
if(QString::compare(previousItemName, name) != 0)
|
||||
{
|
||||
canAddNewPoint = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(canAddNewPoint)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(name);
|
||||
item->setFont(QFont("Times", 12, QFont::Bold));
|
||||
VNodeDetail node(id, typeTool, typeNode, mx, my, reverse);
|
||||
|
@ -205,6 +213,7 @@ void DialogDetail::NewItem(quint32 id, const Tool &typeTool, const NodeDetail &t
|
|||
|
||||
ui.doubleSpinBoxBiasX->blockSignals(false);
|
||||
ui.doubleSpinBoxBiasY->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -402,9 +411,56 @@ void DialogDetail::DeleteItem()
|
|||
EnableObjectGUI(false);
|
||||
}
|
||||
|
||||
delete ui.listWidget->item( ui.listWidget->currentRow() );
|
||||
if (CreateDetail().ContourPoints(data).size() < 3 )
|
||||
{
|
||||
ValidObjects(false);
|
||||
}
|
||||
delete ui.listWidget->item(ui.listWidget->currentRow());
|
||||
ValidObjects(DetailIsValid());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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) */
|
||||
bool closed;
|
||||
bool flagWidth;
|
||||
bool DetailIsValid() const;
|
||||
bool FirstPointEqualLast() const;
|
||||
|
||||
void NewItem(quint32 id, const Tool &typeTool, const NodeDetail &typeNode,
|
||||
qreal mx = 0, qreal my = 0, bool reverse = false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user