Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix qml monitor scene keyframe when seeking out of a clip

parent 0dc470b4
......@@ -61,8 +61,13 @@ void KeyframeView::slotModelChanged()
update();
}
void KeyframeView::slotSetPosition(int pos)
void KeyframeView::slotSetPosition(int pos, bool isInRange)
{
if (!isInRange) {
m_position = -1;
update();
return;
}
if (pos != m_position) {
m_position = pos;
emit atKeyframe(m_model->hasKeyframe(pos), m_model->singleKeyframe());
......@@ -299,10 +304,12 @@ void KeyframeView::paintEvent(QPaintEvent *event)
/*
* current position
*/
QPolygon pa(3);
int cursorwidth = (m_size - (m_lineHeight + headOffset / 2)) / 2 + 1;
QPolygonF position = QPolygonF() << QPointF(-cursorwidth, m_size) << QPointF(cursorwidth, m_size) << QPointF(0, m_lineHeight + (headOffset / 2) + 1);
position.translate(m_position * m_scale, 0);
p.setBrush(m_colKeyframe);
p.drawPolygon(position);
if (m_position >= 0) {
QPolygon pa(3);
int cursorwidth = (m_size - (m_lineHeight + headOffset / 2)) / 2 + 1;
QPolygonF position = QPolygonF() << QPointF(-cursorwidth, m_size) << QPointF(cursorwidth, m_size) << QPointF(0, m_lineHeight + (headOffset / 2) + 1);
position.translate(m_position * m_scale, 0);
p.setBrush(m_colKeyframe);
p.drawPolygon(position);
}
}
......@@ -37,7 +37,7 @@ public:
public slots:
/* @brief moves the current position*/
void slotSetPosition(int pos);
void slotSetPosition(int pos, bool isInRange);
/* @brief remove the keyframe at given position
If pos is negative, we remove keyframe at current position
*/
......
......@@ -95,6 +95,7 @@ void GeometryEditWidget::monitorSeek(int pos)
// Update monitor scene for geometry params
if (pos >= m_range.first && pos < m_range.second) {
m_geom->connectMonitor(true);
pCore->getMonitor(m_model->monitorId)->setEffectKeyframe(true);
} else {
m_geom->connectMonitor(false);
}
......
......@@ -122,10 +122,11 @@ void KeyframeWidget::monitorSeek(int pos)
{
int in = pCore->getItemPosition(m_model->getOwnerId());
int out = in + pCore->getItemDuration(m_model->getOwnerId());
m_buttonAddDelete->setEnabled(pos - in > 0);
connectMonitor(pos >= in && pos < out);
bool isInRange = pos >= in && pos < out;
m_buttonAddDelete->setEnabled(isInRange);
connectMonitor(isInRange);
int framePos = qBound(in, pos, out) - in;
m_keyframeview->slotSetPosition(framePos);
m_keyframeview->slotSetPosition(framePos, isInRange);
m_time->setValue(framePos);
}
......@@ -164,10 +165,10 @@ void KeyframeWidget::slotSetPosition(int pos, bool update)
{
if (pos < 0) {
pos = m_time->getValue();
m_keyframeview->slotSetPosition(pos);
m_keyframeview->slotSetPosition(pos, true);
} else {
m_time->setValue(pos);
m_keyframeview->slotSetPosition(pos);
m_keyframeview->slotSetPosition(pos, true);
}
slotRefreshParams();
......
......@@ -427,6 +427,7 @@ void GeometryWidget::connectMonitor(bool activate)
QRect rect(m_spinX->value(), m_spinY->value(), m_spinWidth->value(), m_spinHeight->value());
m_monitor->setUpEffectGeometry(rect);
} else {
m_monitor->setEffectKeyframe(false);
disconnect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment