Mercurial > hg > svgui
comparison widgets/Panner.cpp @ 1238:4d0ca1ab4cd0
Some work to make spectrum layers (and slice layers generally) zoomable in the frequency axis. Also fixes a number of view id mixups in SliceLayer which broke offset calculations for the x axis scale.
author | Chris Cannam |
---|---|
date | Tue, 07 Feb 2017 14:55:19 +0000 |
parents | 4a578a360011 |
children | 13f5f84fbfad |
comparison
equal
deleted
inserted
replaced
1237:2cc9e0e5df51 | 1238:4d0ca1ab4cd0 |
---|---|
17 | 17 |
18 #include <QMouseEvent> | 18 #include <QMouseEvent> |
19 #include <QPaintEvent> | 19 #include <QPaintEvent> |
20 #include <QWheelEvent> | 20 #include <QWheelEvent> |
21 #include <QPainter> | 21 #include <QPainter> |
22 | |
23 #include "WidgetScale.h" | |
22 | 24 |
23 #include <iostream> | 25 #include <iostream> |
24 #include <cmath> | 26 #include <cmath> |
25 | 27 |
26 Panner::Panner(QWidget *parent) : | 28 Panner::Panner(QWidget *parent) : |
154 paint.setRenderHint(QPainter::Antialiasing, false); | 156 paint.setRenderHint(QPainter::Antialiasing, false); |
155 | 157 |
156 QColor bg(palette().background().color()); | 158 QColor bg(palette().background().color()); |
157 bg.setAlpha(m_backgroundAlpha); | 159 bg.setAlpha(m_backgroundAlpha); |
158 | 160 |
159 paint.setPen(palette().dark().color()); | 161 int penWidth = WidgetScale::scalePixelSize(1); |
162 if (penWidth < 1) penWidth = 1; | |
163 paint.setPen(QPen(palette().dark().color(), penWidth)); | |
164 | |
160 paint.setBrush(bg); | 165 paint.setBrush(bg); |
161 paint.drawRect(0, 0, width()-1, height()-1); | 166 paint.drawRect(penWidth/2, penWidth/2, |
167 width()-penWidth/2-1, height()-penWidth/2-1); | |
162 | 168 |
163 QColor hl(m_thumbColour); | 169 QColor hl(m_thumbColour); |
164 hl.setAlpha(m_thumbAlpha); | 170 hl.setAlpha(m_thumbAlpha); |
165 | 171 |
166 paint.setBrush(hl); | 172 paint.setBrush(hl); |