X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fkeyframehelper.cpp;h=d67bd29f9b3649860a8ede54ab7f8b9247f39fb2;hb=5e07370d2e189d73d43bb7dc9be562a8cbc2720f;hp=52241f6458bf21fb9dd868eb48c8424cc407069a;hpb=a6fe00242d71093faaeda3dd7e7387eea2269be8;p=kdenlive diff --git a/src/keyframehelper.cpp b/src/keyframehelper.cpp index 52241f64..d67bd29f 100644 --- a/src/keyframehelper.cpp +++ b/src/keyframehelper.cpp @@ -36,15 +36,17 @@ const int cursorWidth = 6; #define SEEK_INACTIVE (-1) KeyframeHelper::KeyframeHelper(QWidget *parent) : - QWidget(parent), - m_geom(NULL), - m_position(0), - m_scale(0), - m_movingKeyframe(false), - m_lineHeight(9), - m_drag(false), - m_hoverKeyframe(-1), - m_seekPosition(SEEK_INACTIVE) + QWidget(parent) + , frameLength(1) + , m_geom(NULL) + , m_position(0) + , m_scale(0) + , m_movingKeyframe(false) + , m_movingItem() + , m_lineHeight(9) + , m_drag(false) + , m_hoverKeyframe(-1) + , m_seekPosition(SEEK_INACTIVE) { setFont(KGlobalSettings::toolBarFont()); setMouseTracking(true); @@ -100,10 +102,13 @@ void KeyframeHelper::mousePressEvent(QMouseEvent * event) } } if (event->y() >= m_lineHeight && event->y() < height()) { - m_drag = true; - m_seekPosition = xPos / m_scale; - emit requestSeek(m_seekPosition); - update(); + int seekRequest = xPos / m_scale; + m_drag = true; + if (seekRequest != m_position) { + m_seekPosition = seekRequest; + emit requestSeek(m_seekPosition); + update(); + } } } @@ -289,7 +294,7 @@ void KeyframeHelper::paintEvent(QPaintEvent *e) p.setPen(palette().dark().color()); p.drawLine(margin, m_lineHeight, width() - margin - 1, m_lineHeight); p.drawLine(margin, m_lineHeight - 3, margin, m_lineHeight + 3); - p.drawLine(width() - margin - 1, m_lineHeight - 3, width() - margin - 1, m_lineHeight + 3); + p.drawLine(width() - margin, m_lineHeight - 3, width() - margin, m_lineHeight + 3); // draw pointer if (m_seekPosition != SEEK_INACTIVE) { @@ -323,7 +328,7 @@ void KeyframeHelper::setValue(const int pos) void KeyframeHelper::setKeyGeometry(Mlt::Geometry *geom, const int length) { m_geom = geom; - frameLength = length; + frameLength = qMax(1, length); update(); }