Fontconfig has 11 font weights defined:
While Qt only has 5:
And so getFCWeight maps FC weights to Qt weights:
Problem is that granularity is lost with that mapping, so if two fonts, that only differ with weight, are added, there's no way of telling which of them will be selected.
The Ubuntu Font Family ships both a Normal and a Medium of its font, both of which end up to be QFont::Normal. Unfortunately for some reason the Medium one has preference over the Normal one, so all Qt apps end up using Medium as their default.
While solving https://bugreports.qt-project.org/browse/QTBUG-25814 would help our particular issue, it wouldn't solve the underlying problem.
IMO the database should drop duplicates, keeping only the closest possible mapping. I.e. if there's a Normal and a Medium, only the Normal would be available.