Commit 66ddbb3b authored by Michael Pyne's avatar Michael Pyne
Browse files

playlist: Avoid resizing columns until after we've generated weights.

This avoids warnings about undefined use of NaN and similar, when we try
to resize the columns too early (before there are any tracks to use to
inform average column widths).
parent b67785f9
......@@ -1658,12 +1658,16 @@ void Playlist::slotUpdateColumnWidths()
// Make sure that the column weights have been initialized before trying to
// update the columns.
QList<int> visibleColumns;
QVector<int> visibleColumns;
for(int i = 0; i < columnCount(); i++) {
if(visibleColumns.isEmpty()) {
// convenience handler for deprecated text metrics
const auto textWidth = [](const QFontMetrics &fm, const QString &text) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
......@@ -1725,6 +1729,11 @@ void Playlist::slotUpdateColumnWidths()
foreach(int column, visibleColumns)
totalWeight += m_columnWeights[column];
// This can happen during startup, before we have the tracks loaded.
if(qFuzzyIsNull(totalWeight)) {
// Computed a "weighted width" for each visible column. This would be the
// width if we didn't have to handle the cases of minimum and maximum widths.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment