Mercurial > hg > svgui
diff widgets/Panner.cpp @ 188:dd573e090eed
* Add range input dialog
* Make Panner support middle-click/ctrl-left-click to reset and emit
doubleClicked when doubleClicked instead of resetting
* Use range input dialog to enter new values for panner on double-click
author | Chris Cannam |
---|---|
date | Fri, 12 Jan 2007 21:52:56 +0000 |
parents | 42118892f428 |
children | 5b7472db612b |
line wrap: on
line diff
--- a/widgets/Panner.cpp Fri Jan 12 14:49:18 2007 +0000 +++ b/widgets/Panner.cpp Fri Jan 12 21:52:56 2007 +0000 @@ -53,20 +53,26 @@ void Panner::mousePressEvent(QMouseEvent *e) { - if (e->button() == Qt::LeftButton) { + if (e->button() == Qt::MidButton || + ((e->button() == Qt::LeftButton) && + (e->modifiers() & Qt::ControlModifier))) { + resetToDefault(); + } else if (e->button() == Qt::LeftButton) { m_clicked = true; m_clickPos = e->pos(); m_dragStartX = m_rectX; m_dragStartY = m_rectY; - } else if (e->button() == Qt::MidButton) { - resetToDefault(); } } void Panner::mouseDoubleClickEvent(QMouseEvent *e) { - resetToDefault(); + if (e->button() != Qt::LeftButton) { + return; + } + + emit doubleClicked(); } void @@ -158,6 +164,15 @@ } void +Panner::getRectExtents(float &x0, float &y0, float &width, float &height) +{ + x0 = m_rectX; + y0 = m_rectY; + width = m_rectWidth; + height = m_rectHeight; +} + +void Panner::setRectExtents(float x0, float y0, float width, float height) { std::cerr << "Panner::setRectExtents(" << x0 << ", " << y0 << ", "