Of course lol. Whenever you substitute, you have to change everything in terms of that substitution (the dx -> d(theta), the original expression -> new expression, limits -> new limits)
You only need to use the triangle when going back to the original variable.