The script makes it clear that Qui-Gon and Obi-Wan both knew (or at least very strongly suspected):
PADME: I am Queen Amidala.
JAR JAR and ANAKIN are stunned.
PADME: (points to Queen) This is my decoy... my protection... my loyal bodyguard.
OBI-WAN and QUI-GON give each other a knowing look.
The Terry Brooks novelisation gives an indication of precisely when Qui-Gon Jinn first began to suspect that something was amiss;
Queen Amidala leaned forward, and a slender white hand came out to
touch the droid's domed casing. "Thank you Artoo-Detoo. You have
proven both loyal and brave." She glanced over her shoulder. "Padme."
One of her handmaidens came forward. Qui-gon Jinn, listening to the
exchange with half an ear as he considered the problems that lay ahead
on Tatooine, noticed that it was the young woman who had supported
the Queen's decision to escape from Naboo. He frowned. Except, it
hadn't been exactly like that . . .
"See to the cleaning up of this little droid." The Queen was speaking
to the girl. "Artoo-Detoo deserves our gratitude." She turned back to
Panaka. "Please continue with your report Captain."
and we have (canon) confirmation from Amidala herself that Qui-Gon definitely worked it out in Star Wars: Queen's Shadow
“You’re in select company, Senator,” Padmé told him. They paused to let a larger group pass them by. Several of them bade Senator Organa a good evening, but none of them overstayed their welcome. “Only a few people know the full lengths my most loyal bodyguards can go to, and only one other person has ever figured it out on their own while we were in the middle of a deception.”
“It was mostly chance, I think,” he said. “If I hadn’t caught you at just that moment, in that light, and with that expression on your face, it wouldn’t have occurred to me.”
“I am usually much better at controlling my expression,” Padmé admitted ruefully. “We were in a tighter spot than usual, though I suppose at least this time, the only thing at stake was my professional pride.”
“Who is the other?” Organa asked.
“His name was Qui-Gon Jinn, a Jedi,” Padmé said. As always, a feeling of almost overwhelming sadness threatened her when she thought of him. He had been patient and understanding of her, never asking for more than she was willing to give, and he had given all, in the end.