We’ve been using Qt’s WebKit as a chat history control. similar to skype, it lists the conversation history, highlighting the name of the person, showing his/her text, and allowing for easy select and copy.
For some reasons beyond my control, my app isn’t allowed to use Qt’s WebKit anymore. I am looking for alternatives that’ll ideally use controls in qt’s basic offering (i’m more than willing to extend).
- display a skype-like chat history with name of person, text and timestamp
- be able to have odd-even background colors for chat history rows
- be scrollable
- easy selection with mouse of text in a freeform fashion
- dynamically be able to have chat history rows added to it, and scroll to the bottom to display them, in case the user scrolled up
Any suggestions? Do you think I can use the rich edit control for this? does it have a read-only mode?
QTextBrowser + html combination can be used, which allows to achieve pretty advanced level of formatting with html. For example (assuming ui->textBrowser is QTextBrowser):
Prints messages from two users in different colors. Methods on_UserXMessage_received can be ultimately complicated adding user name, time-stamp, and so forth…