Staring/looking at the Holy Ka'abah is an act of worship even if this took place while performing a prayer, since Al-Baihaqee stated that the Prophet (PBUH) said: " Staring at the Holy Ka'abah is an act of devotion." [Sho'aab Al-Imaan]. And Allah Knows Best.