OK.
A painter draws in paint device (widget in this case ) local coordinates.
Meaning that when you used my previous suggestion, something got filled, but not the right thing .

Thus, everything must be drawn relative to (0,0).
Calling p.fillRect( 0, 0, size().width(), size().height(), Qt:red ) will fill the ENTIRE widget.
For what you were trying to achieve call p.fillRect( 0, 0, 30, 6, Qt:red ). This will fill a small rect in the top left corner of the widget.

To be sure just do a drawRect( 0, 0, size().width(), size().height() ) - draw a frame around the widget.

If this works ( and it will ), draw everything relative to (0, 0 ) - lines, etc.

It's probably late in your area, but do you have any last suggestions for today?
It's 11 PM, not so late.

Regards