From 846ac49ab812fff90df36d97f08d97f206cff158 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 3 Nov 2021 14:27:21 +0100 Subject: [PATCH] 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...). --- hurricane/src/viewer/CellViewer.cpp | 4 ++-- hurricane/src/viewer/CellWidget.cpp | 8 ++++---- hurricane/src/viewer/ControllerWidget.cpp | 2 +- hurricane/src/viewer/Selector.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hurricane/src/viewer/CellViewer.cpp b/hurricane/src/viewer/CellViewer.cpp index 750bcc24..7c88a62c 100644 --- a/hurricane/src/viewer/CellViewer.cpp +++ b/hurricane/src/viewer/CellViewer.cpp @@ -754,10 +754,10 @@ namespace Hurricane { } - void CellViewer::setShowSelection ( bool state ) + void CellViewer::setShowSelection ( bool ) { _updateState = InternalEmit; - _cellWidget->setShowSelection ( state ); + _cellWidget->setShowSelection ( not _cellWidget->showSelection() ); } diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index 1c480ae8..24d0d75a 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1128,8 +1128,8 @@ namespace Hurricane { _textFontHeight = QFontMetrics(font).ascent(); if (Graphics::isHighDpi()) { - resize( Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) - , Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",350)->asInt()) ); + resize( Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",500)->asInt()) + , Graphics::toHighDpi(Cfg::getParamInt("viewer.minimumSize",500)->asInt()) ); } } @@ -1285,7 +1285,6 @@ namespace Hurricane { _state->setShowSelection ( state ); _selectionHasChanged = false; refresh (); - emit selectionModeChanged (); } } @@ -1320,7 +1319,7 @@ namespace Hurricane { void CellWidget::_redraw ( QRect redrawArea ) { - //cerr << "CellWidget::redraw() - start " + //cerr << "CellWidget::_redraw() - start " // << _selectionHasChanged << " filter:" // << _state->getQueryFilter() << endl; @@ -2788,6 +2787,7 @@ namespace Hurricane { if ( occurrence.getOwnerCell() != getCell() ) throw Error( "CellWidget::toggleSelection(): Occurrence do not belong to the loaded cell." ); + cerr << "CellWidget::toggleSelection() " << occurrence << endl; Property* property = occurrence.getProperty( Selector::getPropertyName() ); Selector* selector = NULL; if (not property) { diff --git a/hurricane/src/viewer/ControllerWidget.cpp b/hurricane/src/viewer/ControllerWidget.cpp index 729045d9..acdfb9e6 100644 --- a/hurricane/src/viewer/ControllerWidget.cpp +++ b/hurricane/src/viewer/ControllerWidget.cpp @@ -605,7 +605,7 @@ namespace Hurricane { Graphics::getGraphics()->addObserver( &_observer ); - resize( Graphics::toHighDpi(620), Graphics::toHighDpi(500) ); + resize( Graphics::toHighDpi(1000), Graphics::toHighDpi(700) ); } diff --git a/hurricane/src/viewer/Selector.cpp b/hurricane/src/viewer/Selector.cpp index dfdb010f..dee89f82 100644 --- a/hurricane/src/viewer/Selector.cpp +++ b/hurricane/src/viewer/Selector.cpp @@ -186,7 +186,7 @@ namespace Hurricane { if (not widget) 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 ); }