Nope. The rules do say if you are traded during your walk year that you will be free of a QO. But that is based upon the collective bargaining agreement. It is not some side agreement between team and player. In fact the collective bargaining agreement forbids team and player from entering into any such side agreement.
The rules with respect to picking up options are different. Here it is permitted for a trade to include a commitment to pick up or not pick up an option.
Cespedes had an unusual clause in his contract that would have prevented the Tigers and then the Mets from offering him a QO. Something like they had to release him the day the season ended? I remember he had to renegotiate his contract with the Mets in order for them to be eligible to resign him before the date clubs can resign players they non-tendered. Since he had been traded he couldn't be offered a QO anyways, so the contract alteration allowed him to have one more big market suitor.
Sorry for the poor explanation, but I never really understood the Cespedes situation in the first place.
I believe Danys Baez had a clause in his contract that he wouldn't receive a qualifying offer (not sure, but I remember there being something odd about his contract). He left the Braves and signed with the Orioles and the Braves did get the Orioles pick at #69 (Josh Fields, who didn't sign).
Cespedes is not a 6 year service time free agent. The clause in his contract forces a non-tender I think, and that's why a QO is off the table. It's a smart move for Cuban players in his position if they're willing to forego an extra year on their first contract. Gonna work out real well for Cespedes.