For these functions, the caller should call with the enum values 'Qt.AscendingOrder'/'Qt.DescendingOrder'.

To make this clearer, it would be good to do: "Qt::SortOrder sortOrder(static_cast<Qt::SortOrder>(key))".  Also, "key" is not a great name for this parameter, as it isn't a key.