BlockView changes: fixed right-click while selecting, new signal "selectionChanged()"
This commit is contained in:
@@ -213,7 +213,12 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
|
||||
match_bus = bus_from = 0;
|
||||
hpin = 0;
|
||||
copy_dp = QPointF();
|
||||
//qDebug() << mm_cancel << mm_copy << mm_drag << new_branch << new_bus;
|
||||
//qDebug() << mm_cancel << moved << sel_rect.isVisible();
|
||||
if (sel_rect.isVisible()) {
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
i->setSelected(i->data(1000).toBool());
|
||||
}
|
||||
if (mm_copy && mm_cancel) {
|
||||
deleteCopyTemp();
|
||||
mm_copy = moved = false;
|
||||
@@ -242,7 +247,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
|
||||
mm_drag = moved = false;
|
||||
screen_point = me->screenPos();
|
||||
scene_point = me->scenePos();
|
||||
if ((me->button() == Qt::MidButton)) {
|
||||
if ((me->button() == Qt::MidButton) || (me->button() == Qt::RightButton)) {
|
||||
thumbShow();
|
||||
restartTimer(timer_thumb, thumb_hide_delay);
|
||||
return true;
|
||||
@@ -655,7 +660,7 @@ void BlockView::mousePressEvent(QMouseEvent * event) {
|
||||
press_point = event->pos();
|
||||
if (event->buttons().testFlag(Qt::MidButton) || event->buttons().testFlag(Qt::RightButton)) {
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
sel_rect.hide();
|
||||
//sel_rect.hide();
|
||||
if (sel_rect.scene())
|
||||
scene_->removeItem(&sel_rect);
|
||||
}
|
||||
@@ -1208,6 +1213,7 @@ void BlockView::applySelRect(QGraphicsSceneMouseEvent * me) {
|
||||
QList<QGraphicsItem*> ci = sel_rect.collidingItems(Qt::IntersectsItemBoundingRect);
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
bool add = me->modifiers().testFlag(Qt::ControlModifier);
|
||||
QList<QGraphicsItem*> sil = scene_->selectedItems();
|
||||
if (!add) clearSelection();
|
||||
else {
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
@@ -1216,6 +1222,8 @@ void BlockView::applySelRect(QGraphicsSceneMouseEvent * me) {
|
||||
foreach (QGraphicsItem * i, ci) {
|
||||
i->setSelected(!i->isSelected());
|
||||
}
|
||||
if (sil != scene_->selectedItems())
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ signals:
|
||||
void connectionsChanged();
|
||||
void copyEnabledChanged(bool);
|
||||
void pasteEnabledChanged(bool);
|
||||
void selectionChanged();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user