version 1.11.0
BlockView selection fixes
This commit is contained in:
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||
project(qad)
|
||||
set(qad_MAJOR 1)
|
||||
set(qad_MINOR 10)
|
||||
set(qad_MINOR 11)
|
||||
set(qad_REVISION 0)
|
||||
set(qad_SUFFIX )
|
||||
set(qad_COMPANY SHS)
|
||||
|
||||
@@ -48,7 +48,7 @@ void BlockView::_init() {
|
||||
_talpha = 0.;
|
||||
ae_enabled = is_block_anim = is_nav_anim = true;
|
||||
nav_prev_aa = nav_prev_imaa = nav_prev_grid = true;
|
||||
square_node = false;
|
||||
square_node = block_emit_selection = false;
|
||||
thumb_size = QSizeF(200, 200);
|
||||
if (scene() == 0) {
|
||||
scene_ = new QGraphicsScene;
|
||||
@@ -216,8 +216,11 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
|
||||
//qDebug() << mm_cancel << moved << sel_rect.isVisible();
|
||||
if (sel_rect.isVisible()) {
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
block_emit_selection = true;
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
i->setSelected(i->data(1000).toBool());
|
||||
block_emit_selection = false;
|
||||
emit selectionChanged();
|
||||
}
|
||||
if (mm_copy && mm_cancel) {
|
||||
deleteCopyTemp();
|
||||
@@ -932,10 +935,15 @@ void BlockView::thumbShow() {
|
||||
|
||||
|
||||
void BlockView::clearSelection() {
|
||||
bool pb = block_emit_selection;
|
||||
block_emit_selection = true;
|
||||
sel_items.clear();
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
if (i->flags().testFlag(QGraphicsItem::ItemIsSelectable)) i->setSelected(false);
|
||||
block_emit_selection = pb;
|
||||
if (!block_emit_selection)
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -1214,6 +1222,7 @@ void BlockView::applySelRect(QGraphicsSceneMouseEvent * me) {
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
bool add = me->modifiers().testFlag(Qt::ControlModifier);
|
||||
QList<QGraphicsItem*> sil = scene_->selectedItems();
|
||||
block_emit_selection = true;
|
||||
if (!add) clearSelection();
|
||||
else {
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
@@ -1222,6 +1231,7 @@ void BlockView::applySelRect(QGraphicsSceneMouseEvent * me) {
|
||||
foreach (QGraphicsItem * i, ci) {
|
||||
i->setSelected(!i->isSelected());
|
||||
}
|
||||
block_emit_selection = false;
|
||||
if (sil != scene_->selectedItems())
|
||||
emit selectionChanged();
|
||||
}
|
||||
@@ -1835,6 +1845,8 @@ void BlockView::removeJunk() {
|
||||
void BlockView::sceneSelectionChanged() {
|
||||
bool ie = scene()->selectedItems().isEmpty();
|
||||
emit copyEnabledChanged(!ie);
|
||||
if (!block_emit_selection)
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -1997,17 +2009,27 @@ void BlockView::pasteFromClipboard() {
|
||||
|
||||
|
||||
void BlockView::selectNone() {
|
||||
bool pb = block_emit_selection;
|
||||
block_emit_selection = true;
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
i->setSelected(false);
|
||||
block_emit_selection = pb;
|
||||
if (!block_emit_selection)
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
void BlockView::selectAll() {
|
||||
bool pb = block_emit_selection;
|
||||
block_emit_selection = true;
|
||||
QList<QGraphicsItem*> gi = scene_->items();
|
||||
foreach (QGraphicsItem * i, gi)
|
||||
if (i->flags().testFlag(QGraphicsItem::ItemIsSelectable))
|
||||
i->setSelected(true);
|
||||
block_emit_selection = pb;
|
||||
if (!block_emit_selection)
|
||||
emit selectionChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ protected:
|
||||
int timer_thumb, thumb_hide_delay, thick;
|
||||
bool mm_drag, new_bus, new_branch, moved, mm_cancel, iconnect, mm_copy, mm_thumb, ae_enabled, is_nav_anim, is_block_anim, move_bus_point;
|
||||
bool grid_visible, grid_snap, pm_connect, navigation, m_connect, m_trace_with_buses, m_pin_mc, minimap, prev_tcb, wheel_zoom;
|
||||
bool nav_prev_aa, nav_prev_imaa, nav_prev_grid, square_node;
|
||||
bool nav_prev_aa, nav_prev_imaa, nav_prev_grid, square_node, block_emit_selection;
|
||||
double grid_step, grid_points, cur_scl, _talpha, thumb_scl;
|
||||
double prev_app_scale;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user