You should assign a filled QSqlForm to it.

PS. filter should contain only the condition from the WHERE clause.