I am an ex Port Health Officer, the Q flag says "My Ship is Healthy, I request free Pratique", "Pratique" is the right to hold free intercourse with the port (usually taken totally literally by the crew).
If the ships is carrying persons suspected of having a Quarantinable Disease, it would display flag "L" not "Q"
I am not up to date on the current quarantinable diseases but last time I looked, they were:
Plague
Cholera
Smallpox (that ages me)
Typhus (note, not Typhoid)
Yellow Fever
Louse Borne Relapsing Fever
In other words, these diseases were most threatening.
If there were an unexplained death on board we were usually notified by radio in advance of arrival.