using qt generic algorithms