Fix crash under Qt5.

The reason is that. (QMap::begin() - 1) + 1 will fail under Qt5, though it
equals QMap::begin() under Qt4.

However, this is undefined behavior, so we should not depend on it even
under Qt4.