Fix a sync problem between the EquiWidget and the SelectionWidget.

This commit is contained in:
Jean-Paul Chaput 2023-05-06 18:13:39 +02:00
parent c53fc01cb2
commit 96e6c9dd06
3 changed files with 32 additions and 27 deletions

View File

@ -2683,7 +2683,8 @@ namespace Hurricane {
} else
selected = false;
if ( (--_delaySelectionChanged == 0) and selected ) emit selectionChanged( _selectors );
if ( (--_delaySelectionChanged == 0) and selected )
emit selectionChanged( _selectors );
}
@ -2708,7 +2709,8 @@ namespace Hurricane {
// } else
// selected = false;
if ( (--_delaySelectionChanged == 0) and selected ) emit selectionChanged( _selectors );
if ( (--_delaySelectionChanged == 0) and selected )
emit selectionChanged( _selectors );
}
@ -2733,7 +2735,8 @@ namespace Hurricane {
// } else
// selected = false;
if ( (--_delaySelectionChanged == 0) and selected ) emit selectionChanged( _selectors );
if ( (--_delaySelectionChanged == 0) and selected )
emit selectionChanged( _selectors );
}
@ -2758,7 +2761,8 @@ namespace Hurricane {
// } else
// selected = false;
if ( (--_delaySelectionChanged == 0) and selected ) emit selectionChanged( _selectors );
if ( (--_delaySelectionChanged == 0) and selected )
emit selectionChanged( _selectors );
}
@ -2819,7 +2823,7 @@ namespace Hurricane {
if ( (--_delaySelectionChanged == 0) and selected ) {
if ( _state->showSelection() ) _redrawManager.refresh ();
emit selectionChanged(_selectors);
emit selectionChanged(_selectors);
}
}
@ -2857,7 +2861,8 @@ namespace Hurricane {
}
_selectionHasChanged = true;
if ( (_delaySelectionChanged == 0) and unselected ) emit selectionChanged( _selectors );
if ( (_delaySelectionChanged == 0) and unselected )
emit selectionChanged( _selectors );
}
@ -2869,7 +2874,8 @@ namespace Hurricane {
unselect( Occurrence( component ));
}
}
if ( --_delaySelectionChanged == 0 ) emit selectionChanged( _selectors );
if ( --_delaySelectionChanged == 0 )
emit selectionChanged( _selectors );
}
@ -2881,7 +2887,8 @@ namespace Hurricane {
unselect( occurrence );
}
}
if ( --_delaySelectionChanged == 0 ) emit selectionChanged( _selectors );
if ( --_delaySelectionChanged == 0 )
emit selectionChanged( _selectors );
}
@ -2893,7 +2900,8 @@ namespace Hurricane {
unselect( occurrence );
}
}
if ( --_delaySelectionChanged == 0 ) emit selectionChanged( _selectors );
if ( --_delaySelectionChanged == 0 )
emit selectionChanged( _selectors );
}
@ -2904,7 +2912,8 @@ namespace Hurricane {
_state->getSelection().clear ();
_unselectAll ();
if ( --_delaySelectionChanged == 0 ) emit selectionChanged(_selectors);
if ( --_delaySelectionChanged == 0 )
emit selectionChanged(_selectors);
}

View File

@ -91,8 +91,8 @@ namespace Hurricane {
{
if (not _cellWidget) return;
if (not isCumulative()) clear ();
beginResetModel();
if (not isCumulative()) _selection.clear ();
for ( Selector* selector : selection ) {
if (not selector->isInModel(_cellWidget)) {

View File

@ -191,26 +191,22 @@ namespace Tramontana {
_forceReselect = false;
}
SelectedEquiSet::iterator remove;
SelectedEquiSet::iterator isel = _selecteds.begin ();
SelectedEquiSet::iterator isel = _selecteds.begin ();
while ( isel != _selecteds.end() ) {
switch ( isel->getAccesses() ) {
case 1: break;
case 64:
emit equipotentialSelect ( isel->getEqui()->getFlatComponents() );
break;
case 0:
emit equipotentialUnselect ( isel->getEqui()->getFlatComponents() );
remove = isel;
++isel;
_selecteds.erase( remove );
continue;
default:
cerr << Bug( "EquipotentialsWidget::updateSelecteds(): invalid code %d"
, isel->getAccesses()) << endl;
SelectedEquiSet::iterator remove = isel++;
if (remove->getAccesses() == 0) {
emit equipotentialUnselect ( remove->getEqui()->getFlatComponents() );
_selecteds.erase( remove );
}
}
isel = _selecteds.begin ();
while ( isel != _selecteds.end() ) {
if (isel->getAccesses() == 64) {
emit equipotentialSelect ( isel->getEqui()->getFlatComponents() );
}
++isel;
}
isel = _selecteds.begin ();
if (_cellWidget) _cellWidget->closeRefreshSession ();
}