Skip to content

Commit 5c05c76

Browse files
committed
Controller I/O table: sort Action column by display string
1 parent eb4343b commit 5c05c76

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/controllers/controllerinputmappingtablemodel.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,16 @@ QVariant ControllerInputMappingTableModel::data(const QModelIndex& index,
210210
return QVariant(mapping.options);
211211
}
212212
return QVariant::fromValue(mapping.options);
213-
case MIDI_COLUMN_ACTION:
214-
if (role == Qt::UserRole) {
215-
// TODO(rryan): somehow get the delegate display text?
216-
return QVariant(mapping.control.group + QStringLiteral(",") + mapping.control.item);
213+
case MIDI_COLUMN_ACTION: {
214+
if (role == Qt::UserRole) { // sort by displaystring
215+
QStyledItemDelegate* del = getDelegateForIndex(index);
216+
VERIFY_OR_DEBUG_ASSERT(del) {
217+
return QString();
218+
}
219+
return del->displayText(QVariant::fromValue(mapping.control), QLocale());
217220
}
218221
return QVariant::fromValue(mapping.control);
222+
}
219223
case MIDI_COLUMN_COMMENT:
220224
return mapping.description;
221225
default:

0 commit comments

Comments
 (0)