Fetching details from the dictionary...

thank you (for the meal); that was a delicious meal
thank you (for displaying lovey-dovey behaviour)
食事を終えて「ご馳走様」と言った。
I said 'thank you for the meal' after finishing.
美味しい料理を食べて「ご馳走様でした」。
After eating delicious food, I said 'thank you for the meal.'
レストランを出る時に「ご馳走様」と挨拶した。
I said 'thank you for the meal' when leaving the restaurant.