X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsmallruler.cpp;h=ee77912f7855c03d34e02aece1298dd88e54980c;hb=c3302003093710ee247ad84c0fe2ef3c579d417f;hp=cc5f1999a25408ab1a897b069c9cd00f6d05b5ee;hpb=e3585512b383f0ecbf677c6bb8663033e0c71dc0;p=kdenlive diff --git a/src/smallruler.cpp b/src/smallruler.cpp index cc5f1999..ee77912f 100644 --- a/src/smallruler.cpp +++ b/src/smallruler.cpp @@ -47,7 +47,7 @@ SmallRuler::SmallRuler(Monitor *monitor, Render *render, QWidget *parent) : m_zoneColor.setAlpha(180); setMouseTracking(true); - setMinimumHeight(8); + setMinimumHeight(QFontInfo(font()).pixelSize()); adjustScale(m_maxval); } @@ -108,13 +108,13 @@ void SmallRuler::setZone(int start, int end) updatePixmap(); } -void SmallRuler::setMarkers(QList < CommentedTime > list) +void SmallRuler::setMarkers(const QList &list) { m_markers = list; updatePixmap(); } -QPoint SmallRuler::zone() +QPoint SmallRuler::zone() const { return QPoint(m_zoneStart, m_zoneEnd); } @@ -122,6 +122,7 @@ QPoint SmallRuler::zone() // virtual void SmallRuler::mousePressEvent(QMouseEvent * event) { + m_render->setActiveMonitor(); const int pos = event->x() / m_scale; if (event->button() == Qt::RightButton) { // Right button clicked, move selection zone @@ -181,7 +182,7 @@ void SmallRuler::mouseMoveEvent(QMouseEvent * event) } else if (qAbs((pos - m_zoneEnd) * m_scale) < 4) { setToolTip(i18n("Zone end: %1", m_monitor->getTimecodeFromFrames(m_zoneEnd))); } - for (int i = 0; i < m_markers.count(); i++) { + for (int i = 0; i < m_markers.count(); ++i) { if (qAbs((pos - m_markers.at(i).time().frames(m_monitor->fps())) * m_scale) < 4) { // We are on a marker QString markerxt = m_monitor->getMarkerThumb(m_markers.at(i).time()); @@ -261,7 +262,7 @@ void SmallRuler::updatePixmap() } // draw markers if (!m_markers.isEmpty()) { - for (int i = 0; i < m_markers.count(); i++) { + for (int i = 0; i < m_markers.count(); ++i) { int pos = m_markers.at(i).time().frames(m_monitor->fps()) * m_scale; p.setPen(CommentedTime::markerColor(m_markers.at(i).markerType())); p.drawLine(pos, 0, pos, 9); @@ -286,7 +287,7 @@ void SmallRuler::paintEvent(QPaintEvent *e) int cursorPos = m_cursorFramePosition * m_scale; // draw pointer QPolygon pa(3); - pa.setPoints(3, cursorPos - 6, 7, cursorPos + 6, 7, cursorPos/*+0*/, 0); + pa.setPoints(3, cursorPos - 6, height() - 1, cursorPos + 6, height() - 1, cursorPos/*+0*/, height() - 8); p.setBrush(m_cursorColor); p.setPen(Qt::NoPen); p.drawPolygon(pa);