Fixed triggering validation a detail.

Two new cases: has been changed Reverse option and the list
has been scrolled. Fixed validation when the list conatains only curve.
(grafted from 87af46985d0867d550605810c5c5a9c2c72f4a0b)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-02-10 21:39:20 +02:00
parent aa67e04a3e
commit 44aac2179b
2 changed files with 8 additions and 9 deletions

View File

@ -7,6 +7,7 @@
- [#325] Check pattern for inverse compatibility. - [#325] Check pattern for inverse compatibility.
# Version 0.4.2 # Version 0.4.2
- Fixed triggering validation a detail. Two new cases: has been changed Reverse option and the list has been scrolled.
- Fixed broken path to measurements after using Save As option. - Fixed broken path to measurements after using Save As option.
- Tool line. Block selecting the same point twice. - Tool line. Block selecting the same point twice.
- [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths. - [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths.

View File

@ -387,6 +387,7 @@ void DialogDetail::ClickedReverse(bool checked)
VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)); VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
node.setReverse(checked); node.setReverse(checked);
item->setData(Qt::UserRole, QVariant::fromValue(node)); item->setData(Qt::UserRole, QVariant::fromValue(node));
ValidObjects(DetailIsValid());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -450,6 +451,7 @@ void DialogDetail::ScrollUp()
{ {
QListWidgetItem *item = ui.listWidget->takeItem(0); QListWidgetItem *item = ui.listWidget->takeItem(0);
ui.listWidget->addItem(item); ui.listWidget->addItem(item);
ValidObjects(DetailIsValid());
} }
} }
@ -460,6 +462,7 @@ void DialogDetail::ScrollDown()
{ {
QListWidgetItem *item = ui.listWidget->takeItem(ui.listWidget->count()-1); QListWidgetItem *item = ui.listWidget->takeItem(ui.listWidget->count()-1);
ui.listWidget->insertItem(0, item); ui.listWidget->insertItem(0, item);
ValidObjects(DetailIsValid());
} }
} }
@ -475,7 +478,7 @@ bool DialogDetail::DetailIsValid() const
pixmap.save(&buffer, "PNG"); pixmap.save(&buffer, "PNG");
QString url = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + QLatin1Literal("\"/> "); QString url = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + QLatin1Literal("\"/> ");
if (ui.listWidget->count() < 3) if(CreateDetail().ContourPoints(data).count() < 3)
{ {
url += tr("You need more points!"); url += tr("You need more points!");
ui.helpLabel->setText(url); ui.helpLabel->setText(url);
@ -538,17 +541,12 @@ bool DialogDetail::FirstPointEqualLast() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogDetail::DetailIsClockwise() const bool DialogDetail::DetailIsClockwise() const
{ {
if(ui.listWidget->count() < 3) const QVector<QPointF> points = CreateDetail().ContourPoints(data);
if(points.count() < 3)
{ {
return false; return false;
} }
VDetail detail;
for (qint32 i = 0; i < ui.listWidget->count(); ++i)
{
QListWidgetItem *item = ui.listWidget->item(i);
detail.append( qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)));
}
const QVector<QPointF> points = detail.ContourPoints(data);
const qreal res = VDetail::SumTrapezoids(points); const qreal res = VDetail::SumTrapezoids(points);
if (res < 0) if (res < 0)