diff options
author | Owen Williams <owilliams@mixxx.org> | 2023-05-30 17:15:03 -0400 |
---|---|---|
committer | Owen Williams <owilliams@mixxx.org> | 2023-05-31 12:08:15 -0400 |
commit | d7c37a9e74a625da0c56568fc1fd9703473b0c0b (patch) | |
tree | 60470e60e84847837b9a0556a76e5075adcc5aac /src | |
parent | 88e990a8149da95f0b4c9599bdbaad039e9c7dee (diff) |
Silence some float conversion warnings by making conversion explicit
Diffstat (limited to 'src')
-rw-r--r-- | src/waveform/renderers/allshader/waveformrenderbeat.cpp | 2 | ||||
-rw-r--r-- | src/waveform/renderers/allshader/waveformrendererendoftrack.cpp | 2 | ||||
-rw-r--r-- | src/waveform/renderers/allshader/waveformrendermark.cpp | 2 | ||||
-rw-r--r-- | src/waveform/renderers/allshader/waveformrendermarkrange.cpp | 2 | ||||
-rw-r--r-- | src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp | 18 | ||||
-rw-r--r-- | src/waveform/renderers/qtwaveformrenderersimplesignal.cpp | 6 | ||||
-rw-r--r-- | src/waveform/renderers/waveformmarkrange.cpp | 4 | ||||
-rw-r--r-- | src/waveform/renderers/waveformrendererhsv.cpp | 4 | ||||
-rw-r--r-- | src/waveform/renderers/waveformrendermark.cpp | 4 | ||||
-rw-r--r-- | src/waveform/renderers/waveformsignalcolors.cpp | 32 | ||||
-rw-r--r-- | src/widget/openglwindow.cpp | 8 | ||||
-rw-r--r-- | src/widget/woverview.cpp | 4 | ||||
-rw-r--r-- | src/widget/woverviewhsv.cpp | 2 | ||||
-rw-r--r-- | src/widget/wspinnybase.cpp | 9 |
14 files changed, 60 insertions, 39 deletions
diff --git a/src/waveform/renderers/allshader/waveformrenderbeat.cpp b/src/waveform/renderers/allshader/waveformrenderbeat.cpp index 7d21cd38c1..933837303b 100644 --- a/src/waveform/renderers/allshader/waveformrenderbeat.cpp +++ b/src/waveform/renderers/allshader/waveformrenderbeat.cpp @@ -49,7 +49,7 @@ void WaveformRenderBeat::paintGL() { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - m_color.setAlphaF(alpha / 100.0); + m_color.setAlphaF(alpha / 100.0f); const int trackSamples = m_waveformRenderer->getTrackSamples(); if (trackSamples <= 0) { diff --git a/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp b/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp index 320585bfe5..57927b392d 100644 --- a/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp +++ b/src/waveform/renderers/allshader/waveformrendererendoftrack.cpp @@ -104,7 +104,7 @@ void WaveformRendererEndOfTrack::paintGL() { if (alpha != 0.0) { QColor color = m_color; - color.setAlphaF(alpha); + color.setAlphaF(static_cast<float>(alpha)); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/waveform/renderers/allshader/waveformrendermark.cpp b/src/waveform/renderers/allshader/waveformrendermark.cpp index c74b362f95..db8b7d1ec9 100644 --- a/src/waveform/renderers/allshader/waveformrendermark.cpp +++ b/src/waveform/renderers/allshader/waveformrendermark.cpp @@ -208,7 +208,7 @@ void allshader::WaveformRenderMark::paintGL() { if (visible || currentMarkEndPoint > 0) { QColor color = pMark->fillColor(); - color.setAlphaF(0.4); + color.setAlphaF(0.4f); drawMark( QRectF(QPointF(currentMarkPoint, 0), diff --git a/src/waveform/renderers/allshader/waveformrendermarkrange.cpp b/src/waveform/renderers/allshader/waveformrendermarkrange.cpp index ad5c35ce0d..2ed3b0d5a3 100644 --- a/src/waveform/renderers/allshader/waveformrendermarkrange.cpp +++ b/src/waveform/renderers/allshader/waveformrendermarkrange.cpp @@ -108,7 +108,7 @@ void allshader::WaveformRenderMarkRange::paintGL() { } QColor color = markRange.enabled() ? markRange.m_activeColor : markRange.m_disabledColor; - color.setAlphaF(0.3); + color.setAlphaF(0.3f); fillRect(QRectF(startPosition, 0, span, m_waveformRenderer->getBreadth()), color); } diff --git a/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp b/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp index ee627b65c2..17a4e3e529 100644 --- a/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp +++ b/src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp @@ -28,13 +28,13 @@ void QtWaveformRendererFilteredSignal::onSetup(const QDomNode& /*node*/) { QColor midCenter = mid; QColor highCenter = high; - low.setAlphaF(0.9); - mid.setAlphaF(0.9); - high.setAlphaF(0.9); + low.setAlphaF(0.9f); + mid.setAlphaF(0.9f); + high.setAlphaF(0.9f); - lowCenter.setAlphaF(0.5); - midCenter.setAlphaF(0.5); - highCenter.setAlphaF(0.5); + lowCenter.setAlphaF(0.5f); + midCenter.setAlphaF(0.5f); + highCenter.setAlphaF(0.5f); QLinearGradient gradientLow(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); gradientLow.setColorAt(0.0, low); @@ -60,9 +60,9 @@ void QtWaveformRendererFilteredSignal::onSetup(const QDomNode& /*node*/) { gradientHigh.setColorAt(1.0, high); m_highBrush = QBrush(gradientHigh); - low.setAlphaF(0.3); - mid.setAlphaF(0.3); - high.setAlphaF(0.3); + low.setAlphaF(0.3f); + mid.setAlphaF(0.3f); + high.setAlphaF(0.3f); QLinearGradient gradientKilledLow(QPointF(0.0,-255.0/2.0),QPointF(0.0,255.0/2.0)); gradientKilledLow.setColorAt(0.0,low.darker(80)); diff --git a/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp b/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp index 5cdce479b3..774bc1b31b 100644 --- a/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp +++ b/src/waveform/renderers/qtwaveformrenderersimplesignal.cpp @@ -23,12 +23,12 @@ void QtWaveformRendererSimpleSignal::onSetup(const QDomNode& node) { Q_UNUSED(node); QColor borderColor = m_pColors->getSignalColor().lighter(125); - borderColor.setAlphaF(0.5); + borderColor.setAlphaF(0.5f); m_borderPen.setColor(borderColor); - m_borderPen.setWidthF(1.25); + m_borderPen.setWidthF(1.25f); QColor signalColor = m_pColors->getSignalColor(); - signalColor.setAlphaF(0.8); + signalColor.setAlphaF(0.8f); m_brush = QBrush(signalColor); } diff --git a/src/waveform/renderers/waveformmarkrange.cpp b/src/waveform/renderers/waveformmarkrange.cpp index b5451edc26..1df2c6c797 100644 --- a/src/waveform/renderers/waveformmarkrange.cpp +++ b/src/waveform/renderers/waveformmarkrange.cpp @@ -122,7 +122,7 @@ void WaveformMarkRange::generateImage(int weidth, int height) { m_disabledImage.fill(QColor(0,0,0,0).rgba()); QColor activeColor = m_activeColor; - activeColor.setAlphaF(0.3); + activeColor.setAlphaF(0.3f); QBrush brush(activeColor); QPainter painter; @@ -131,7 +131,7 @@ void WaveformMarkRange::generateImage(int weidth, int height) { painter.end(); QColor disabledColor = m_disabledColor; - disabledColor.setAlphaF(0.3); + disabledColor.setAlphaF(0.3f); brush = QBrush(disabledColor); painter.begin(&m_disabledImage); diff --git a/src/waveform/renderers/waveformrendererhsv.cpp b/src/waveform/renderers/waveformrendererhsv.cpp index 453b4c10d0..7236a01043 100644 --- a/src/waveform/renderers/waveformrendererhsv.cpp +++ b/src/waveform/renderers/waveformrendererhsv.cpp @@ -162,11 +162,11 @@ void WaveformRendererHSV::draw( lo = (maxLow[0] + maxLow[1]) / total; hi = (maxHigh[0] + maxHigh[1]) / total; } else { - lo = hi = 0.0; + lo = hi = 0.0f; } // Set color - color.setHsvF(h, 1.0-hi, 1.0-lo); + color.setHsvF(h, 1.0f - hi, 1.0f - lo); pen.setColor(color); diff --git a/src/waveform/renderers/waveformrendermark.cpp b/src/waveform/renderers/waveformrendermark.cpp index 7d928cef12..75fb3de7bf 100644 --- a/src/waveform/renderers/waveformrendermark.cpp +++ b/src/waveform/renderers/waveformrendermark.cpp @@ -88,7 +88,7 @@ void WaveformRenderMark::draw(QPainter* painter, QPaintEvent* /*event*/) { sampleEndPosition); if (visible || currentMarkEndPoint > 0) { QColor color = pMark->fillColor(); - color.setAlphaF(0.4); + color.setAlphaF(0.4f); QLinearGradient gradient(QPointF(0, 0), QPointF(0, m_waveformRenderer->getHeight())); @@ -131,7 +131,7 @@ void WaveformRenderMark::draw(QPainter* painter, QPaintEvent* /*event*/) { sampleEndPosition); if (currentMarkEndPoint < m_waveformRenderer->getHeight()) { QColor color = pMark->fillColor(); - color.setAlphaF(0.4); + color.setAlphaF(0.4f); QLinearGradient gradient(QPointF(0, 0), QPointF(m_waveformRenderer->getWidth(), 0)); diff --git a/src/waveform/renderers/waveformsignalcolors.cpp b/src/waveform/renderers/waveformsignalcolors.cpp index c8c7061dc6..14a485e1c8 100644 --- a/src/waveform/renderers/waveformsignalcolors.cpp +++ b/src/waveform/renderers/waveformsignalcolors.cpp @@ -142,29 +142,41 @@ void WaveformSignalColors::fallBackFromSignalColor() { if (s < 0.1) { // gray const float sMax = 1.0f - h; m_lowColor.setHslF(h,s,l); - m_midColor.setHslF(h,s+sMax*0.2,l); - m_highColor.setHslF(h,s+sMax*0.4,l); + m_midColor.setHslF(h, s + sMax * 0.2f, l); + m_highColor.setHslF(h, s + sMax * 0.4f, l); } else { if (l < 0.1) { // ~white const float lMax = 1.0f - l; m_lowColor.setHslF(h,s,l); - m_midColor.setHslF(h,s,l+lMax*0.2); - m_highColor.setHslF(h,s,l+lMax*0.4); + m_midColor.setHslF(h, s, l + lMax * 0.2f); + m_highColor.setHslF(h, s, l + lMax * 0.4f); } else if (l < 0.5) { const float lMax = 1.0f - l; m_lowColor.setHslF(h,s,l); - m_midColor.setHslF(stableHue(h-analogousAngle*0.3),s,l+lMax*0.1); - m_highColor.setHslF(stableHue(h+analogousAngle*0.3),s,l+lMax*0.4); + m_midColor.setHslF( + static_cast<float>(stableHue(h - analogousAngle * 0.3)), + s, + l + lMax * 0.1f); + m_highColor.setHslF( + static_cast<float>(stableHue(h + analogousAngle * 0.3)), + s, + l + lMax * 0.4f); } else if (l < 0.9) { const float lMin = l; m_lowColor.setHslF(h,s,l); - m_midColor.setHslF(stableHue(h-analogousAngle*0.3),s,l-lMin*0.1); - m_highColor.setHslF(stableHue(h+analogousAngle*0.3),s,l-lMin*0.4); + m_midColor.setHslF( + static_cast<float>(stableHue(h - analogousAngle * 0.3)), + s, + l - lMin * 0.1f); + m_highColor.setHslF( + static_cast<float>(stableHue(h + analogousAngle * 0.3)), + s, + l - lMin * 0.4f); } else { // ~black const float lMin = l; m_lowColor.setHslF(h,s,l); - m_midColor.setHslF(h,s,l-lMin*0.2); - m_highColor.setHslF(h,s,l-lMin*0.4); + m_midColor.setHslF(h, s, l - lMin * 0.2f); + m_highColor.setHslF(h, s, l - lMin * 0.4f); } } diff --git a/src/widget/openglwindow.cpp b/src/widget/openglwindow.cpp index c2249a9e8e..5d4495d783 100644 --- a/src/widget/openglwindow.cpp +++ b/src/widget/openglwindow.cpp @@ -68,8 +68,12 @@ bool OpenGLWindow::event(QEvent* ev) { // Tooltip don't work by forwarding the events. This mimics the // tooltip behavior. if (t == QEvent::MouseMove) { - ToolTipQOpenGL::singleton().start( - m_pWidget, dynamic_cast<QMouseEvent*>(ev)->globalPos()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPoint eventPosition = dynamic_cast<QMouseEvent*>(ev)->globalPosition().toPoint(); +#else + QPoint eventPosition = dynamic_cast<QMouseEvent*>(ev)->globalPos(); +#endif + ToolTipQOpenGL::singleton().start(m_pWidget, eventPosition); } if (t == QEvent::Leave) { ToolTipQOpenGL::singleton().stop(m_pWidget); diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index 71654bb1bf..f925bc72ad 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -912,7 +912,7 @@ void WOverview::drawMarks(QPainter* pPainter, const float offset, const float ga if (rect.isValid()) { QColor loopColor = pMark->fillColor(); - loopColor.setAlphaF(0.5); + loopColor.setAlphaF(0.5f); pPainter->fillRect(rect, loopColor); } @@ -1260,7 +1260,7 @@ void WOverview::drawPassthroughOverlay(QPainter* pPainter) { void WOverview::paintText(const QString& text, QPainter* pPainter) { PainterScope painterScope(pPainter); - m_lowColor.setAlphaF(0.5); + m_lowColor.setAlphaF(0.5f); QPen lowColorPen( QBrush(m_lowColor), 1.25 * m_scaleFactor, Qt::SolidLine, Qt::RoundCap); pPainter->setPen(lowColorPen); diff --git a/src/widget/woverviewhsv.cpp b/src/widget/woverviewhsv.cpp index ece5c954b5..f609ff2af3 100644 --- a/src/widget/woverviewhsv.cpp +++ b/src/widget/woverviewhsv.cpp @@ -113,7 +113,7 @@ bool WOverviewHSV::drawNextPixmapPart() { } // Set color - color.setHsvF(h, 1.0-hi, 1.0-lo); + color.setHsvF(h, 1.0f - hi, 1.0f - lo); painter.setPen(color); painter.drawLine(QPoint(currentCompletion / 2, -maxAll[0]), diff --git a/src/widget/wspinnybase.cpp b/src/widget/wspinnybase.cpp index 0dd7a9b4fd..38a417a330 100644 --- a/src/widget/wspinnybase.cpp +++ b/src/widget/wspinnybase.cpp @@ -513,8 +513,8 @@ void WSpinnyBase::updateSlipEnabled(double enabled) { void WSpinnyBase::mouseMoveEvent(QMouseEvent* e) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - int y = e->position().y(); - int x = e->position().x(); + int y = static_cast<int>(e->position().y()); + int x = static_cast<int>(e->position().x()); #else int y = e->y(); int x = e->x(); @@ -577,8 +577,13 @@ void WSpinnyBase::mousePressEvent(QMouseEvent* e) { } if (e->button() == Qt::LeftButton) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + int y = static_cast<int>(e->position().y()); + int x = static_cast<int>(e->position().x()); +#else int y = e->y(); int x = e->x(); +#endif m_iStartMouseX = x; m_iStartMouseY = y; |