From 8fd038c31b235de0c1ee5b7cc1bc2b945a364116 Mon Sep 17 00:00:00 2001 From: SeeLook <seelook@gmail.com> Date: Sat, 29 Oct 2016 18:22:33 +0200 Subject: [PATCH] Allow in-volume knob to move exactly between 10-80% range --- src/libs/sound/widgets/tvolumeview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/sound/widgets/tvolumeview.cpp b/src/libs/sound/widgets/tvolumeview.cpp index b658b1114..52e5ed7cf 100755 --- a/src/libs/sound/widgets/tvolumeview.cpp +++ b/src/libs/sound/widgets/tvolumeview.cpp @@ -90,7 +90,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) { QRect nRect = painter.fontMetrics().boundingRect(nSymbol); if (m_drawPaused) { // Stop/start highlight painter.setBrush(m_overNote ? qApp->palette().highlightedText().color().darker(95) : qApp->palette().highlight().color()); - painter.drawRoundedRect(width() - nRect.width() * 1.5, 0, nRect.width() * 1.5, height(), 10, 10, Qt::RelativeSize); + painter.drawRoundedRect(width() - nRect.width() * 1.5, 0, nRect.width() * 1.5, height(), 30, 30, Qt::RelativeSize); } if (m_drawPaused) // and note symbol painter.setPen(m_overNote ? qApp->palette().highlight().color() : qApp->palette().highlightedText().color()); @@ -125,7 +125,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) { knobBrush = knobBrush.lighter(); shade.setAlpha(150); painter.setBrush(shade); - float xPos = (float)(width() - m_noteWidth) * m_minVolume; + qreal xPos = (static_cast<qreal>(width()) - m_noteWidth + height() * 0.7) * m_minVolume; painter.drawEllipse(QRectF(xPos - height() * 0.5, height() * 0.1, height() * 0.9, height() * 0.9)); // shade QLinearGradient lg(xPos, 0, xPos, height()); lg.setColorAt(0, knobBrush); @@ -192,7 +192,7 @@ void TvolumeView::mouseMoveEvent(QMouseEvent* event) { m_drawKnob = true; if (m_leftButton) { float minV = static_cast<float>(event->pos().x()) / static_cast<float>(width() - m_noteWidth); - if (minV > 0.09 && minV < 0.81) { + if (minV > 0.1 && minV < 0.8) { m_minVolume = minV; emit minimalVolume(m_minVolume); } -- GitLab