A colloquialism: “To be careful or circumspect in behavior; to be exact” (115). Nobody knows the origin of the term.
Brewer (54) suggests four alternatives: (i) an admonition to children in learning the alphabet to be careful not to mix the lower-case P’s and Q’s, (ii) a similar admonition to printers’ apprentices when handling type, (iii) a saloon keeper’s accounting shorthand: P for pints, Q for quarts, and (iv) during the reign of Louis XIV dancing masters would warn their pupils to mind their P’s (i.e., pieds, feet) and Q’s (i.e., queues, wigs) lest the latter fall off when executing a deep bow. Atkinson (14) suggests that English lawyers are expected to appear in court properly fitted with perukes (wigs), and a century ago would also have needed quill pens to record the proceedings. If their work involved much travel, they had to take particular care that they damaged neither perukes (P) nor quills (Q), since replacements might be hard to find in the hinterlands. Had enough? Let’s move on.