Skip to content

Commit 64e3c52

Browse files
committed
Module add animation experiment
1 parent a77845f commit 64e3c52

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Interface/Application/ModuleProxyWidget.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ namespace SCIRun
111111
}
112112
}
113113

114+
const int fadeInSeconds = 1;
115+
114116
ModuleProxyWidget::ModuleProxyWidget(ModuleWidget* module, QGraphicsItem* parent/* = 0*/)
115117
: QGraphicsProxyWidget(parent),
116118
NoteDisplayHelper(boost::make_shared<ModuleWidgetNoteDisplayStrategy>()),
@@ -133,12 +135,25 @@ ModuleProxyWidget::ModuleProxyWidget(ModuleWidget* module, QGraphicsItem* parent
133135
stackDepth_ = 0;
134136

135137
originalSize_ = size();
138+
139+
{
140+
timeLine_ = new QTimeLine(fadeInSeconds * 1000, this);
141+
connect(timeLine_, SIGNAL(valueChanged(qreal)), this, SLOT(animate(qreal)));
142+
//connect(timeLine_, SIGNAL(finished()), this, SLOT(deleteLater()));
143+
timeLine_->start();
144+
}
136145
}
137146

138147
ModuleProxyWidget::~ModuleProxyWidget()
139148
{
140149
}
141150

151+
void ModuleProxyWidget::animate(qreal val)
152+
{
153+
setOpacity(val);
154+
setScale(val);
155+
}
156+
142157
void ModuleProxyWidget::adjustHeight(int delta)
143158
{
144159
auto p = pos();

src/Interface/Application/ModuleProxyWidget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <Interface/Application/Note.h>
3434
#include <QGraphicsProxyWidget>
3535

36+
class QTimeLine;
37+
3638
namespace SCIRun
3739
{
3840
namespace Gui
@@ -74,6 +76,7 @@ namespace SCIRun
7476
void updateNote(const Note& note);
7577
void ensureThisVisible();
7678
void disableModuleGUI(bool disabled);
79+
void animate(qreal val);
7780
private:
7881
void ensureItemVisible(QGraphicsItem* item);
7982
bool isSubwidget(QWidget* alienWidget) const;
@@ -87,6 +90,7 @@ namespace SCIRun
8790
bool doHighlight_;
8891
int stackDepth_;
8992
QSizeF originalSize_;
93+
QTimeLine* timeLine_;
9094
};
9195

9296
// arbitrary values

0 commit comments

Comments
 (0)