QHeaderView: check that length is correct during restoreState.

Length is supposed to be equal to the section items length, but the state saved might be corrupted.
If so, print a warning, return false and don't restore this corrupted state.

Change-Id: I4d3dfec528a65fc81ed70d1c8cc69c11faf414e0
Task-number: QTBUG-40462
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>