protected boolean lessThan(QModelIndex left, QModelIndex right) {
boolean result = false;
Object leftData = sourceModel().data(left);
Object rightData = sourceModel().data(right);
QRegExp emailPattern = new QRegExp("([\\w\\.]*@[\\w\\.]*)");
String leftString = leftData.toString();
if(left.column() == 1 && emailPattern.indexIn(leftString) != -1)
leftString = emailPattern.cap(1);
String rightString = rightData.toString();
if(right.column() == 1 && emailPattern.indexIn(rightString) != -1)
rightString = emailPattern.cap(1);
result = leftString.compareTo(rightString) < 0;
return result;
}