Smart QTextEdit wrapping

  • I want to implement a new output window for my chat application. For this purpose, I wanted to use a QTextEdit widget. This widget should be able to start each line in the middle of the window so that I can write the names on the other side. This layout is used e.g. in Skype. This works for one row, but when the line has to be wrapped, the layout looks terrible because the message continues right under the name.

    How can I implement such a "smart" wrapping?

  • As far as I understand you may think about a wrong approach. Probably you should two separate widgets in two columns. On one side the widget display the name and on the other side the contributed text. Both widgets could be packed into a horizontal layout to keep them aligned. Each the contributor changes or after each contribution in general you can add a new name/contribution vertically.

Log in to reply