Skip to content

Commit

Permalink
Merge pull request #11668 from burnsak/export_csv_issue
Browse files Browse the repository at this point in the history
Export CSV: fixing null values in export
  • Loading branch information
ronso0 authored Jun 21, 2023
2 parents a18b0b9 + 94a896b commit b437a9f
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,21 +590,9 @@ QVariant BaseTrackTableModel::roleValue(
break;
}
M_FALLTHROUGH_INTENDED;
// Right align BPM, duraation and bitrate so big/small values can easily be
// spotted by length (number of digits)
case Qt::TextAlignmentRole: {
switch (field) {
case ColumnCache::COLUMN_LIBRARYTABLE_BPM:
case ColumnCache::COLUMN_LIBRARYTABLE_DURATION:
case ColumnCache::COLUMN_LIBRARYTABLE_BITRATE: {
// We need to cast to int due to a bug similar to
// https://bugreports.qt.io/browse/QTBUG-67582
return static_cast<int>(Qt::AlignVCenter | Qt::AlignRight);
}
default:
return QVariant(); // default AlignLeft for all other columns
}
}
// NOTE: for export we need to fall through to Qt::DisplayRole,
// so do not add any other role cases here, or the export
// will be empty
case Qt::DisplayRole:
switch (field) {
case ColumnCache::COLUMN_LIBRARYTABLE_DURATION: {
Expand Down Expand Up @@ -873,6 +861,21 @@ QVariant BaseTrackTableModel::roleValue(
return Qt::PartiallyChecked;
}
}
// Right align BPM, duration and bitrate so big/small values can easily be
// spotted by length (number of digits)
case Qt::TextAlignmentRole: {
switch (field) {
case ColumnCache::COLUMN_LIBRARYTABLE_BPM:
case ColumnCache::COLUMN_LIBRARYTABLE_DURATION:
case ColumnCache::COLUMN_LIBRARYTABLE_BITRATE: {
// We need to cast to int due to a bug similar to
// https://bugreports.qt.io/browse/QTBUG-67582
return static_cast<int>(Qt::AlignVCenter | Qt::AlignRight);
}
default:
return QVariant(); // default AlignLeft for all other columns
}
}
default:
DEBUG_ASSERT(!"unexpected role");
break;
Expand Down

0 comments on commit b437a9f

Please sign in to comment.