Qt: fix wrong index bug