QWindowsXP/VistaStyle: Fix detection of item view delegate line edits.

The old code tried to check the 2nd parent for inheritance from
QAbstractItemView. This also triggers for line edits on a QDialog parented
on the item view. Introduce convenience function that checks for
top levels in the chain.

Task-number: QTBUG-37504

Change-Id: I932f8efdb4764e9b1eea84c802bf7e8718338e1d
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
(cherry picked from qtbase/176342e70a1ba7864a5b5dac14d12d4091ef5bd9)