git-svn-id: svn://db.shs.com.ru/libs@299 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2017-10-21 15:41:12 +00:00
parent c3c0bcd1fb
commit 7a43895b07
4 changed files with 90 additions and 32 deletions

View File

@@ -350,8 +350,10 @@ void BlockBusItem::updateGeometry() {
}
void BlockBusItem::checkDelete() {
if (pol.size() < 2 || segments.size() < 1) deleteLater();
bool BlockBusItem::checkDelete() {
if (pol.size() >= 2 && segments.size() >= 1) return false;
deleteLater();
return true;
}
@@ -551,13 +553,13 @@ void BlockBusItem::mousePressEvent(QGraphicsSceneMouseEvent * e) {
if (selPoint >= 0 && selPoint <= pol.size() - 1) {
removePoint(selPoint);
simplify();
emitAction(BlockItemBase::BusPointRemove);
if (!checkDelete()) emitAction(BlockItemBase::BusPointRemove);
return;
}
if (selSegment >= 0 && selSegment <= segments.size() - 1) {
removeSegment(selSegment);
simplify();
emitAction(BlockItemBase::BusSegmentRemove);
if (!checkDelete()) emitAction(BlockItemBase::BusSegmentRemove);
return;
}
}