You must filter the model referenced by the relation, but you can invoke it directly; in your case:
model.relationModel(2).setFilter("city like 'x'");
AFAIK, the filter is affecting a "copy" of the table (a model) that was instantiated in this relation and it does not affect any other instances of the same table.
In fact, you could have something like this:
model.setRelation(2, QSqlRelation("city", "id", "name"))
model.setRelation(4, QSqlRelation("city", "id", "name"))
model.relationModel(2).setFilter("city like 'x'");
model.relationModel(4).setFilter("city like 'y'");
relation (2) and (4) point to the same table, but they have two different models, each one with its own filter.