I want to draw a label between two lines side by side, but when I run the above code label with labelText 3, between two lines is visible. labelText 2, between two lines is not painted. I don,t understand why? Can anybody help me to solve this?

you are creating widgets on every paintEvent call! This is very bad design.

in your Widget::operation() you update your data and call update() to immediately set the data again and call update() again. You should know that update() schedules a paint-event, where multiple calls to update() still result in a single paint-event (in the next event loop iteration). So it doesn't repaint immediately. There is a repaint() method for this, but as i said you already have a bad design by creating widgets on every paintEvent call.

You should draw the text using QPainter instead creating a QLabel every time. But still the label text "2" would never be rendered, since you immediately overwrite it afterwards.

That's fine, what I want to know is how to not delete the drawing from previous paintevent,
because as per your statement:
" But still the label text "2" would never be rendered, since you immediately overwrite it afterwards."
I want to keep the drawing for both:

@VRonin Depends on what he wants to achieve.
Is it a widget, than I agree with you.
Is it some CAD-drawing (looks like a diagram symbol to me), then I would prefer drawing.
For the latter the Graphics View Framework would be more practical though.