Skip to content
Snippets Groups Projects
Commit 8fd038c3 authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Allow in-volume knob to move exactly between 10-80% range

parent fc11c6fd
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) { ...@@ -90,7 +90,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) {
QRect nRect = painter.fontMetrics().boundingRect(nSymbol); QRect nRect = painter.fontMetrics().boundingRect(nSymbol);
if (m_drawPaused) { // Stop/start highlight if (m_drawPaused) { // Stop/start highlight
painter.setBrush(m_overNote ? qApp->palette().highlightedText().color().darker(95) : qApp->palette().highlight().color()); 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 if (m_drawPaused) // and note symbol
painter.setPen(m_overNote ? qApp->palette().highlight().color() : qApp->palette().highlightedText().color()); painter.setPen(m_overNote ? qApp->palette().highlight().color() : qApp->palette().highlightedText().color());
...@@ -125,7 +125,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) { ...@@ -125,7 +125,7 @@ void TvolumeView::paintEvent(QPaintEvent* ) {
knobBrush = knobBrush.lighter(); knobBrush = knobBrush.lighter();
shade.setAlpha(150); shade.setAlpha(150);
painter.setBrush(shade); 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 painter.drawEllipse(QRectF(xPos - height() * 0.5, height() * 0.1, height() * 0.9, height() * 0.9)); // shade
QLinearGradient lg(xPos, 0, xPos, height()); QLinearGradient lg(xPos, 0, xPos, height());
lg.setColorAt(0, knobBrush); lg.setColorAt(0, knobBrush);
...@@ -192,7 +192,7 @@ void TvolumeView::mouseMoveEvent(QMouseEvent* event) { ...@@ -192,7 +192,7 @@ void TvolumeView::mouseMoveEvent(QMouseEvent* event) {
m_drawKnob = true; m_drawKnob = true;
if (m_leftButton) { if (m_leftButton) {
float minV = static_cast<float>(event->pos().x()) / static_cast<float>(width() - m_noteWidth); 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; m_minVolume = minV;
emit minimalVolume(m_minVolume); emit minimalVolume(m_minVolume);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment