Mercurial > hg > svgui
diff widgets/Panner.cpp @ 174:96b8a790730a
* Wire up the Panner widget in the pane, and do some tidying in Pane
author | Chris Cannam |
---|---|
date | Thu, 19 Oct 2006 13:05:39 +0000 |
parents | 9c40dc10c88c |
children | 836498e57f59 |
line wrap: on
line diff
--- a/widgets/Panner.cpp Thu Oct 19 09:57:27 2006 +0000 +++ b/widgets/Panner.cpp Thu Oct 19 13:05:39 2006 +0000 @@ -31,6 +31,9 @@ m_defaultCentreX(0), m_defaultCentreY(0), m_defaultsSet(false), + m_thumbColour(palette().highlightedText().color()), + m_backgroundAlpha(255), + m_thumbAlpha(255), m_clicked(false) { } @@ -40,6 +43,13 @@ } void +Panner::setAlpha(int backgroundAlpha, int thumbAlpha) +{ + m_backgroundAlpha = backgroundAlpha; + m_thumbAlpha = thumbAlpha; +} + +void Panner::mousePressEvent(QMouseEvent *e) { if (e->button() == Qt::LeftButton) { @@ -70,7 +80,9 @@ m_rectY = m_dragStartY + dy; normalise(); - emitAndUpdate(); + repaint(); + emit rectExtentsChanged(m_rectX, m_rectY, m_rectWidth, m_rectHeight); + emit rectCentreMoved(centreX(), centreY()); } void @@ -102,14 +114,14 @@ paint.setRenderHint(QPainter::Antialiasing, false); QColor bg(palette().background().color()); - bg.setAlpha(80); + bg.setAlpha(m_backgroundAlpha); paint.setPen(palette().dark().color()); paint.setBrush(bg); paint.drawRect(0, 0, width(), height()); - QColor hl(palette().highlight().color()); - hl.setAlpha(80); + QColor hl(m_thumbColour); + hl.setAlpha(m_thumbAlpha); paint.setBrush(hl); @@ -147,6 +159,9 @@ void Panner::setRectExtents(float x0, float y0, float width, float height) { + std::cerr << "Panner::setRectExtents(" << x0 << ", " << y0 << ", " + << width << ", " << height << ")" << std::endl; + if (m_rectX == x0 && m_rectY == y0 && m_rectWidth == width &&