fix: art scaling on shrink + skip unavailable tracks in queue
- Now-playing art: use setFixedHeight (not setFixedSize) so the dock width constraint is removed and can shrink freely; use event->size() in resizeEvent to get the correct new width without layout lag - PlayQueue: filter non-streamable tracks out of setContext and reorderContext so unavailable tracks are never in the queue and pressing Next always lands on a playable track Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,15 +84,18 @@ void View::onArtReady(QNetworkReply *reply)
|
||||
void View::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QDockWidget::resizeEvent(event);
|
||||
scaleArtToWidth();
|
||||
if (m_artPixmap.isNull()) return;
|
||||
// Use the new dock width from the event so we don't lag behind the layout
|
||||
const int side = qMax(32, event->size().width() - 16);
|
||||
m_albumArt->setFixedHeight(side);
|
||||
m_albumArt->setPixmap(m_artPixmap.scaled(side, side, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
void View::scaleArtToWidth()
|
||||
{
|
||||
if (m_artPixmap.isNull()) return;
|
||||
// Available width = dock width minus the 8px margins on each side
|
||||
const int side = qMax(32, widget() ? widget()->width() - 16 : width() - 16);
|
||||
m_albumArt->setFixedSize(side, side);
|
||||
const int side = qMax(32, width() - 16);
|
||||
m_albumArt->setFixedHeight(side);
|
||||
m_albumArt->setPixmap(m_artPixmap.scaled(side, side, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user