I have been trying to use a textBrowser
in order to display chat messages in my application. I've set the textBrowser
with HTML enabled. I'm then appending each message to the textBrowser
like so:
ui->textBrowser->append(QString().sprintf("<div style=\"border-bottom:1px solid #eeeeee; background-color:#ffffff;display:block;\"><font color=\"red\"> %s</font></div>",msg.toStdString().c_str()));
However, I am limited in what CSS i can apply to each appended element. For example; - Border does not work - Display block does not work - etc.
I'm now fairly certain that the textBrowser
just does not have the power that i need, I'm aiming in creating a chat message much like Skype is doing it.
What would be the best control to use for this purpose?
Some ideas I have so far:
- Use a scrollArea
and append widgets
inside of them
- Use a listView
(not sure if its possible to style it the way i want)
Key elements i want to include in each chat message are:
- Time
- Avatar picture
- Name
- Text message
Any ideas what the best approach would be here?
Edit
Unfortunately i cant attach an image yet since I'm still new here.