implemented keyframe type changing

Implemented the UI to change a keyframe's type along with the ValueChanged
signals that should result.
This commit is contained in:
itsmattkc
2019-12-27 16:37:06 +11:00
parent 855fe5e93f
commit 3e3963dfaa
11 changed files with 171 additions and 7 deletions
+12 -2
View File
@@ -15,9 +15,9 @@ KeyframeViewItem::KeyframeViewItem(NodeKeyframePtr key, qreal vcenter, QGraphics
{
keyframe_size_ = QFontMetricsWidth(qApp->fontMetrics(), "Oi");
setFlag(QGraphicsItem::ItemIsSelectable);
setFlag(QGraphicsItem::ItemIsMovable);
connect(key.get(), SIGNAL(TimeChanged(const rational&)), this, SLOT(UpdateRect()));
connect(key.get(), &NodeKeyframe::TimeChanged, this, &KeyframeViewItem::UpdateRect);
connect(key.get(), &NodeKeyframe::TypeChanged, this, &KeyframeViewItem::Redraw);
UpdateRect();
}
@@ -28,6 +28,11 @@ void KeyframeViewItem::SetScale(double scale)
UpdateRect();
}
NodeKeyframePtr KeyframeViewItem::key() const
{
return key_;
}
void KeyframeViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setPen(Qt::black);
@@ -66,3 +71,8 @@ void KeyframeViewItem::UpdateRect()
setRect(x_center - keyframe_size_/2, middle_ - keyframe_size_/2, keyframe_size_, keyframe_size_);
}
void KeyframeViewItem::Redraw()
{
QGraphicsItem::update();
}