SmallRuler::SmallRuler(QWidget *parent)
: QWidget(parent), m_scale(1), m_maxval(25) {
+ m_zoneStart = 10;
+ m_zoneEnd = 60;
}
void SmallRuler::adjustScale(int maximum) {
update();
}
+void SmallRuler::setZone(int start, int end) {
+ m_zoneStart = start;
+ m_zoneEnd = end;
+ update();
+}
+
// virtual
void SmallRuler::mousePressEvent(QMouseEvent * event) {
const int pos = event->x() / m_scale;
double f, fend;
p.setPen(palette().dark().color());
+ const int zoneStart = (int)(m_zoneStart * m_scale);
+ const int zoneEnd = (int)(m_zoneEnd * m_scale);
+
+ p.fillRect(QRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2), QBrush(QColor(133, 255, 143)));
+
if (r.top() < 9) {
// draw the little marks
fend = m_scale * m_small;