From bcd59b90c7973439e1669ebd1bdcb6ba8b9816dc Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 10 Feb 2016 21:35:46 +0200 Subject: [PATCH] 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. --HG-- branch : release --- ChangeLog.txt | 1 + src/libs/vtools/dialogs/tools/dialogdetail.cpp | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index d0c03dc5c..f66876f85 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,5 @@ # 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. - Tool line. Block selecting the same point twice. - [#443] Not valid dxf file. libdxf updated to version 3.12.2.0. Fixed drawing subpaths. diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index 4ea1f7f0d..b81f76934 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -387,6 +387,7 @@ void DialogDetail::ClickedReverse(bool checked) VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); node.setReverse(checked); item->setData(Qt::UserRole, QVariant::fromValue(node)); + ValidObjects(DetailIsValid()); } //--------------------------------------------------------------------------------------------------------------------- @@ -450,6 +451,7 @@ void DialogDetail::ScrollUp() { QListWidgetItem *item = ui.listWidget->takeItem(0); ui.listWidget->addItem(item); + ValidObjects(DetailIsValid()); } } @@ -460,6 +462,7 @@ void DialogDetail::ScrollDown() { QListWidgetItem *item = ui.listWidget->takeItem(ui.listWidget->count()-1); ui.listWidget->insertItem(0, item); + ValidObjects(DetailIsValid()); } } @@ -475,7 +478,7 @@ bool DialogDetail::DetailIsValid() const pixmap.save(&buffer, "PNG"); QString url = QString(" "); - if (ui.listWidget->count() < 3) + if(CreateDetail().ContourPoints(data).count() < 3) { url += tr("You need more points!"); ui.helpLabel->setText(url); @@ -538,17 +541,12 @@ bool DialogDetail::FirstPointEqualLast() const //--------------------------------------------------------------------------------------------------------------------- bool DialogDetail::DetailIsClockwise() const { - if(ui.listWidget->count() < 3) + const QVector points = CreateDetail().ContourPoints(data); + + if(points.count() < 3) { return false; } - VDetail detail; - for (qint32 i = 0; i < ui.listWidget->count(); ++i) - { - QListWidgetItem *item = ui.listWidget->item(i); - detail.append( qvariant_cast(item->data(Qt::UserRole))); - } - const QVector points = detail.ContourPoints(data); const qreal res = VDetail::SumTrapezoids(points); if (res < 0)