Using the fact that $$ \hat{Q}\hat{Q}^T=\hat{I}, $$ we can rewrite $$ \hat{T}= \hat{Q}^{T}\hat{A}\hat{Q}, $$ as $$ \hat{Q}\hat{T}= \hat{A}\hat{Q}. $$