#include <KDebug>
#include <KColorScheme>
+#include <KLocale>
#include <QMouseEvent>
#include <QStylePainter>
SmallRuler::SmallRuler(MonitorManager *manager, QWidget *parent) :
- QWidget(parent),
- m_scale(1),
- m_maxval(25),
- m_manager(manager)
+ QWidget(parent)
+ ,m_cursorFramePosition(0)
+ ,m_scale(1)
+ ,m_maxval(25)
+ ,m_manager(manager)
{
m_zoneStart = 10;
m_zoneEnd = 60;
m_zoneColor = KStatefulBrush(KColorScheme::View, KColorScheme::PositiveBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color();
setMouseTracking(true);
+ setMinimumHeight(10);
}
void SmallRuler::adjustScale(int maximum)
const int zoneEnd = (int)(m_zoneEnd * m_scale);
p.fillRect(zoneStart, height() / 2 - 1, zoneEnd - zoneStart, height() / 2, m_zoneColor);
- // draw markers
- if (!m_markers.isEmpty()) {
- p.setPen(Qt::red);
- for (int i = 0; i < m_markers.count(); i++) {
- p.drawLine(m_markers.at(i) * m_scale, 0, m_markers.at(i) * m_scale, 9);
- }
- }
+ // draw ruler
p.setPen(palette().text().color());
// draw the little marks
fend = m_scale * m_small;
if (fend > 2) for (f = 0; f < width(); f += fend) {
- p.drawLine((int)f, 0, (int)f, 3);
- }
+ p.drawLine((int)f, 0, (int)f, 3);
+ }
// draw medium marks
fend = m_scale * m_medium;
if (fend > 2) for (f = 0; f < width(); f += fend) {
- p.drawLine((int)f, 0, (int)f, 6);
+ p.drawLine((int)f, 0, (int)f, 6);
+ }
+ // draw markers
+ if (!m_markers.isEmpty()) {
+ p.setPen(Qt::red);
+ for (int i = 0; i < m_markers.count(); i++) {
+ p.drawLine(m_markers.at(i) * m_scale, 0, m_markers.at(i) * m_scale, 9);
}
+ }
p.end();
update();
}