Skip to content

Commit

Permalink
library: right align BPM, duration & bitrate values
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jun 6, 2023
1 parent d1b1831 commit 1f9f176
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ QVariant BaseTrackTableModel::data(
role != Qt::EditRole &&
role != Qt::CheckStateRole &&
role != Qt::ToolTipRole &&
role != kDataExportRole) {
role != kDataExportRole &&
role != Qt::TextAlignmentRole) {
return QVariant();
}

Expand Down Expand Up @@ -571,6 +572,19 @@ 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: {
return Qt::AlignRight;
}
default:
return QVariant(); // default AlignLeft for all other columns
}
}
case Qt::DisplayRole:
switch (field) {
case ColumnCache::COLUMN_LIBRARYTABLE_DURATION: {
Expand Down

0 comments on commit 1f9f176

Please sign in to comment.