This avoids a double wide edges between headers and the surrounding frame. As a side effect this fixes drawing of some separators, like between A and B in the RTL screenshot.
Only downside is that the last separator is now drawn 1px further outside, so doesn't perfectly align with the table in the third screenshot. I only notice that because I was actively looking for it though.
The spreadsheet application is from qtbase's examples, with the window size forced to 631x427 (any smaller would need scrollbars) with gammaray.
Currently built on top of !54 (merged)