Finally solve the selection desynchronisation problem.

* Bug: In CellViewer::setShowSelection(bool), this slot is connected
    to the hidden 's' menu key. It was toggling state according to
    the state of the *menu key* (Qt) which was *not* kept in synch
    with the state of the CellWidget. So it was causing desinchronized
    selection visibility toggle. Now, ignore the state of the menu
    and toggle the CellWidget state directly.
* Bug: In Selector::attachTo(), when adding the new CellWidget to the
    map<>, the initial flag must be Selector::Selected instead of 0,
    so we see it.
* Change: In CellWidget & ControllerWidget, adjust the default size of
    the widgets (to better suit my display...).
This commit is contained in:
Jean-Paul Chaput 2021-11-03 14:27:21 +01:00
parent 247ddb3a5c
commit 846ac49ab8
4 changed files with 8 additions and 8 deletions

View File

@ -754,10 +754,10 @@ namespace Hurricane {
} }
void CellViewer::setShowSelection ( bool state ) void CellViewer::setShowSelection ( bool )
{ {
_updateState = InternalEmit; _updateState = InternalEmit;
_cellWidget->setShowSelection ( state ); _cellWidget->setShowSelection ( not _cellWidget->showSelection() );
} }

View File

@ -1128,8 +1128,8 @@ namespace Hurricane {
_textFontHeight = QFontMetrics(font).ascent(); _textFontHeight = QFontMetrics(font).ascent();
if (Graphics::isHighDpi()) { if (Graphics::isHighDpi()) {
resize( Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) resize( Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",500)->asInt())
, Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) ); , Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",500)->asInt()) );
} }
} }
@ -1285,7 +1285,6 @@ namespace Hurricane {
_state->setShowSelection ( state ); _state->setShowSelection ( state );
_selectionHasChanged = false; _selectionHasChanged = false;
refresh (); refresh ();
emit selectionModeChanged (); emit selectionModeChanged ();
} }
} }
@ -1320,7 +1319,7 @@ namespace Hurricane {
void CellWidget::_redraw ( QRect redrawArea ) void CellWidget::_redraw ( QRect redrawArea )
{ {
//cerr << "CellWidget::redraw() - start " //cerr << "CellWidget::_redraw() - start "
// << _selectionHasChanged << " filter:" // << _selectionHasChanged << " filter:"
// << _state->getQueryFilter() << endl; // << _state->getQueryFilter() << endl;
@ -2788,6 +2787,7 @@ namespace Hurricane {
if ( occurrence.getOwnerCell() != getCell() ) if ( occurrence.getOwnerCell() != getCell() )
throw Error( "CellWidget::toggleSelection(): Occurrence do not belong to the loaded cell." ); throw Error( "CellWidget::toggleSelection(): Occurrence do not belong to the loaded cell." );
cerr << "CellWidget::toggleSelection() " << occurrence << endl;
Property* property = occurrence.getProperty( Selector::getPropertyName() ); Property* property = occurrence.getProperty( Selector::getPropertyName() );
Selector* selector = NULL; Selector* selector = NULL;
if (not property) { if (not property) {

View File

@ -605,7 +605,7 @@ namespace Hurricane {
Graphics::getGraphics()->addObserver( &_observer ); Graphics::getGraphics()->addObserver( &_observer );
resize( Graphics::toHighDpi(620), Graphics::toHighDpi(500) ); resize( Graphics::toHighDpi(1000), Graphics::toHighDpi(700) );
} }

View File

@ -186,7 +186,7 @@ namespace Hurricane {
if (not widget) if (not widget)
throw Error( "Selector::attachTo(): Cannot attach, NULL widget argument." ); throw Error( "Selector::attachTo(): Cannot attach, NULL widget argument." );
_cellWidgets.insert( make_pair(widget,0) ); _cellWidgets.insert( make_pair(widget,Selected) );
widget->getSelectorSet().insert( this ); widget->getSelectorSet().insert( this );
} }