#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);
}
}
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();
+ }
}
}
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) {
void KeyframeHelper::setKeyGeometry(Mlt::Geometry *geom, const int length)
{
m_geom = geom;
- frameLength = length;
+ frameLength = qMax(1, length);
update();
}