You can only paint from within the paintEvent() of the widget being painted.