Fixed issue #851. Mouse click on a highlighted object crashes Valentina.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-05-24 09:56:19 +03:00
parent c6e38932dc
commit bb95c3162b

View File

@ -536,32 +536,25 @@ void VMainGraphicsView::mousePressEvent(QMouseEvent *event)
{
QGraphicsView::setDragMode(QGraphicsView::RubberBandDrag);
}
if (showToolOptions)
{
QList<QGraphicsItem *> list = items(event->pos());
if (list.size() == 0)
{
emit itemClicked(nullptr);
break;
}
const QList<QGraphicsItem *> sceneItems = this->scene()->items();
bool success = false;
const QList<QGraphicsItem *> list = items(event->pos());
for (auto item : list)
{
if (sceneItems.contains(item))
{
if (item->type() > QGraphicsItem::UserType && item->type() <= VSimpleCurve::Type)
if (item && item->type() > QGraphicsItem::UserType && item->type() <= VSimpleCurve::Type)
{
emit itemClicked(item);
break;
success = true;
}
else
}
if (not success)
{
emit itemClicked(nullptr);
}
}
}
}
break;
}
case Qt::MiddleButton: