Simple filtering algorithm in using the Qt4 Library