Qt does not has any built-in class to do so. I don't think one can find such a class in any programming framework. It is highly application specific.

You will have to write for yourself using some help from QString and QRegExp

How to add a 12 digit auto incremental field in sql?
I don't think SQL has this ability.

I have a suggestion, instead of concatenating the zip and serial number, have zip code as a field, and serial number in another field. Then zip and serial fields put together will be the primary key. That way querying the rows with same zip code will be possible using standard SQL, an then you could look for the largest serial number.