From 0d0e37adfc13930a840f35aaab4ab88e505c43cf Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Wed, 1 Apr 2020 13:15:34 +0200 Subject: [PATCH 1/2] implement slotClear to clear a single prop visualisation --- PropertyVisPlugin.cc | 22 ++++++++++++++++++++++ PropertyVisPlugin.hh | 1 + 2 files changed, 23 insertions(+) diff --git a/PropertyVisPlugin.cc b/PropertyVisPlugin.cc index b77e7d4..df4b51a 100644 --- a/PropertyVisPlugin.cc +++ b/PropertyVisPlugin.cc @@ -139,6 +139,28 @@ void PropertyVisPlugin::slotVisualizeProperty( int _id, const QString& _propname } } +void PropertyVisPlugin::slotClear(int _id, const QString &_propname) +{ + PropertyModel* model = PropertyModelFactory::Instance().getModel(_id); + + if (model != 0) + { + model->gatherProperties(); + QModelIndex idx = model->indexFromPlainPropName(_propname); + + if (idx.isValid()) + { + QModelIndexList list; + list.append(idx); + + model->clear(list); + + emit updateView(); + emit updatedObject( _id, UPDATE_COLOR ); + } + } +} + QScriptValue PropertyVisPlugin::getPropertyVisualizer(int _id, const QString &_propname) { PropertyModel* model = PropertyModelFactory::Instance().getModel(_id); diff --git a/PropertyVisPlugin.hh b/PropertyVisPlugin.hh index 8a17d0b..79f8a5d 100644 --- a/PropertyVisPlugin.hh +++ b/PropertyVisPlugin.hh @@ -150,6 +150,7 @@ private slots: public slots: void slotVisualizeProperty( int _id, const QString& _propname ); + void slotClear( int _id, const QString& _propname ); QScriptValue getPropertyVisualizer( int _id, const QString& _propname ); -- GitLab From 0ea3c4e587cb186bdc249fad241f1430c798506f Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Thu, 23 Apr 2020 13:13:59 +0200 Subject: [PATCH 2/2] Add comments for add/clear slots. --- PropertyVisPlugin.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PropertyVisPlugin.hh b/PropertyVisPlugin.hh index 79f8a5d..590eb07 100644 --- a/PropertyVisPlugin.hh +++ b/PropertyVisPlugin.hh @@ -149,8 +149,16 @@ private slots: public slots: + /// Visualise a property on object _id with the given name. + /// Note that for multiple properties with the same name (i.e., different + /// data types or entity types), there is no guarantee which one is used. void slotVisualizeProperty( int _id, const QString& _propname ); + + /// Remove visualisation of a property on object _id with the given name. + /// Note that for multiple properties with the same name (i.e., different + /// data types or entity types), there is no guarantee which one is used. void slotClear( int _id, const QString& _propname ); + QScriptValue getPropertyVisualizer( int _id, const QString& _propname ); -- GitLab