Making a modern-looking message-list in Qt?

39 Views Asked by At

I am trying to make a chat application.

I have a QListView widget which I want to fill with messages. I want to make the application look like modern chats (Messenger, Instagram, etc).

More details: I want the messages to be able to stick to each side of the widget and maybe add some rounding on the borders.

Example in HTML/CSS:

.message-container {
  width: 100%;
  height: 20rem;
  background: red;
}

.line {
  display: block;
}

.message {
  display: inline-block;
  height: 3rem;
  line-height: 3rem;
  border-radius: 1.5rem;
  padding: 0 1rem;
  background: green;
}

.right {
  float: right;
}
<html>
  <body>
    <div class="message-container">
      <div class="line"><div class="message">Hello</div></div>
      <div class="line"><div class="message right">Hello friend!</div></div>
    </div>
  </body>
</html>

  1. Is QListView helpful for this job?
  2. What is the best way to achieve something like that?

NOTES: I though a way would be using frames but I feel like I'm thinking a lot in HTML terms. I have made some Qt GUI in the past, but it's the first time trying to decorate it.

0

There are 0 best solutions below