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

This commit is contained in:
2019-09-12 11:56:33 +00:00
parent 7d05789819
commit fd7465c449

View File

@@ -158,6 +158,7 @@ bool BlockView::event(QEvent * e) {
bool BlockView::eventFilter(QObject * o, QEvent * e) {
if (o == &widget_thumb) {
QMouseEvent * me = (QMouseEvent*)e;
if(!me) return true;
switch (e->type()) {
case QEvent::Paint:
drawThumb();
@@ -236,9 +237,12 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
}
break;*/
case QEvent::GraphicsSceneMousePress:
if (mm_ci != 0)
if (mm_ci->data(1008).toBool())
if (mm_ci != 0) {
if (mm_ci->data(1008).toBool()) {
mm_ci = 0;
break;
}
}
//qDebug() << "press";
if (me->buttons().testFlag(Qt::LeftButton)) btncnt++;
if (me->buttons().testFlag(Qt::RightButton)) btncnt++;
@@ -282,11 +286,17 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
return true;
}
mil = scene_->items(scene_point);
mm_ci = (mil.isEmpty() ? 0 : mil.front());
if (mil.isEmpty()) return true;
if (mm_ci != 0) {
if (mm_ci->data(1008).toBool())
break;
//qDebug() << mil;
while (!mil.isEmpty()) {
mm_ci = mil.front();
if (mm_ci->data(1008).toBool()) {
mil.pop_front();
} else break;
}
if (mil.isEmpty()) {
mm_ci = 0;
return true;
}
while (mm_ci->data(1005).toString() == "connection") {
if (qgraphicsitem_cast<BlockBusItem*>(mm_ci))
if (qgraphicsitem_cast<BlockBusItem*>(mm_ci)->isBusSelected())
@@ -324,7 +334,6 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
}
return true;
}
}
if (mm_ci) {
if (mm_ci->data(1004) == "pin" && m_connect) {
if (qgraphicsitem_cast<BlockItemPin*>(mm_ci)->state() == BlockItemPin::Hover) {
@@ -364,8 +373,10 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
ghost_->setPos(quantize(me->scenePos(), grid_step));
}*/
if (mm_ci)
if (mm_ci->data(1008).toBool())
if (mm_ci->data(1008).toBool()) {
mm_ci = 0;
break;
}
if (mm_cancel) return true;
if (me->buttons().testFlag(Qt::LeftButton)) {
if (!mm_drag) {
@@ -705,6 +716,7 @@ void BlockView::scrolled() {
void BlockView::mouseMoveEvent(QMouseEvent * event) {
if (!event) return;
if (navigation) {
if (event->buttons().testFlag(Qt::MidButton) || event->buttons().testFlag(Qt::RightButton)) {
QPoint dp = (press_point - event->pos());
@@ -952,7 +964,7 @@ void BlockView::clearSelection() {
sel_items.clear();
QList<QGraphicsItem*> gi = scene_->items();
foreach (QGraphicsItem * i, gi)
i->setSelected(false);
if (i->flags().testFlag(QGraphicsItem::ItemIsSelectable)) i->setSelected(false);
}