@@ -111,8 +111,6 @@ namespace SCIRun
111111 }
112112}
113113
114- const int fadeInSeconds = 1 ;
115-
116114ModuleProxyWidget::ModuleProxyWidget (ModuleWidget* module , QGraphicsItem* parent/* = 0*/ )
117115 : QGraphicsProxyWidget(parent),
118116 NoteDisplayHelper(boost::make_shared<ModuleWidgetNoteDisplayStrategy>()),
@@ -136,23 +134,55 @@ ModuleProxyWidget::ModuleProxyWidget(ModuleWidget* module, QGraphicsItem* parent
136134
137135 originalSize_ = size ();
138136
139- {
140- timeLine_ = new QTimeLine (fadeInSeconds * 1000 , this );
141- connect (timeLine_, SIGNAL (valueChanged (qreal)), this , SLOT (animate (qreal)));
142- // timeLine_->start();
143- }
137+ // {
138+ // const int fadeInSeconds = 1;
139+ // timeLine_ = new QTimeLine(fadeInSeconds * 1000, this);
140+ // connect(timeLine_, SIGNAL(valueChanged(qreal)), this, SLOT(loadAnimate(qreal)));
141+ // timeLine_->start();
142+ // }
144143}
145144
146145ModuleProxyWidget::~ModuleProxyWidget ()
147146{
148147}
149148
150- void ModuleProxyWidget::animate (qreal val)
149+ void ModuleProxyWidget::showAndColor (const QColor& color)
150+ {
151+ animateColor_ = color;
152+ timeLine_ = new QTimeLine (4000 , this );
153+ connect (timeLine_, SIGNAL (valueChanged (qreal)), this , SLOT (colorAnimate (qreal)));
154+ timeLine_->start ();
155+ ensureThisVisible ();
156+ }
157+
158+ void ModuleProxyWidget::loadAnimate (qreal val)
151159{
152160 setOpacity (val);
153161 setScale (val);
154162}
155163
164+ void ModuleProxyWidget::colorAnimate (qreal val)
165+ {
166+ if (val < 1 )
167+ {
168+ auto effect = graphicsEffect ();
169+ if (!effect)
170+ {
171+ auto colorize = new QGraphicsColorizeEffect;
172+ colorize->setColor (animateColor_);
173+ setGraphicsEffect (colorize);
174+ }
175+ else if (auto c = dynamic_cast <QGraphicsColorizeEffect*>(effect))
176+ {
177+ auto newColor = c->color ();
178+ newColor.setAlphaF (1 - val);
179+ c->setColor (newColor);
180+ }
181+ }
182+ else // 1 = done coloring
183+ setGraphicsEffect (nullptr );
184+ }
185+
156186void ModuleProxyWidget::adjustHeight (int delta)
157187{
158188 auto p = pos ();
@@ -181,7 +211,7 @@ void ModuleProxyWidget::ensureThisVisible()
181211
182212void ModuleProxyWidget::ensureItemVisible (QGraphicsItem* item)
183213{
184- auto views = scene ()->views ();
214+ auto views = item-> scene ()->views ();
185215 if (!views.isEmpty ())
186216 {
187217 auto netEd = qobject_cast<NetworkEditor*>(views[0 ]);
@@ -213,6 +243,7 @@ void ModuleProxyWidget::disableModuleGUI(bool disabled)
213243
214244void ModuleProxyWidget::mousePressEvent (QGraphicsSceneMouseEvent *event)
215245{
246+ clearNoteCursor ();
216247 auto taggingOn = data (TagLayerKey).toBool ();
217248 auto currentTag = data (CurrentTagKey).toInt ();
218249 if (taggingOn && currentTag > NoTag)
0 commit comments