We are in the same boat right now...

As long as the your current employer(A) will be issuing an NOC then there will never be a problem. Im planning to exit to Dubai also, I am just waiting for the offer letter from a company here in qatar..

Upon exiting Dubai, the new VISA which will be provided to you by company (B) will be sent to you usually through e-mail and you will be re-entering Qatar after.

Good Luck...