S
S
Stepan2021-07-21 19:44:26
Qt Creator
Stepan, 2021-07-21 19:44:26

How to change the position of an individual element in a verticalLayout?

I am creating a chat in QT C++. Has reached development of a field where messages are displayed. One message is one label. But my message (blue) should be displayed on the right, and the interlocutor - on the left. But verticalLayout lays them out on the same side. How to change location? Or maybe the list of messages can be implemented differently?
60f84ec8d51af293467622.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jacob E, 2021-07-21
@Zifix

https://doc.qt.io/qt-5/qlabel.html#indent-prop
As for the implementation, this is a big and complicated topic, but I would recommend to deal with the models right away (at least https://doc.qt. io/qt-5/qstringlistmodel.html ) and QListView, they have useful features like https://doc.qt.io/qt-5/qabstractitemmodel.html#can...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question