PDA

View Full Version : QLabel inside QTextEdit



zgulser
23rd July 2012, 08:05
Hi,

As you can see from the sample.png attached, the notification label overlays the message box and this leads a problem that message can be read partially.

I want that label to be always one line lower then the last message letter.

To do so, I wrote something like the following;



my_notification_label->move(0, my_text_edit->viewport()->height());


it puts the label to the right place once but it didn't move message size grows(or scroll bar appears).

wysota
23rd July 2012, 08:17
You forgot to attach the screenshot. Anyway, you should probably use layouts for controlling the size and placement of widgets.

zgulser
23rd July 2012, 09:27
Oh yeah,

I just attached it.



Anyway, you should probably use layouts for controlling the size and placement of widgets


But the label should overlay the QTextEdit at the bottom. I suppose I need to apart the message text in another textfield and put it into the main text field together with notification label.

wysota
23rd July 2012, 14:08
Make the label a child of the text edit, set viewport margins on the bottom of the text edit and reimplement the resize event for the text edit to adjust the bottom margin of the viewport and position of the label.