I have a QListView which I fill with a QSqlQueryModel that select datasets from the QSqLite database.
The datasets I get have two columns:
| msg | ownership |
----------------------
| test1 | 0 |
| test2 | 1 |
| test3 | 1 |
| test4 | 0 |
----------------------
| msg | ownership |
----------------------
| test1 | 0 |
| test2 | 1 |
| test3 | 1 |
| test4 | 0 |
----------------------
To copy to clipboard, switch view to plain text mode
The ownership specifies if the messages was sent (0) or received (1).
When I fill the QListView with the data I don't wanna display the ownership, but according to it set the text color and perform an alignment.
e.g. it should look something like this
text1 <-- color red
text2 <-- color green
text3 <-- color green
text4 <-- color red
text1 <-- color red
text2 <-- color green
text3 <-- color green
text4 <-- color red
To copy to clipboard, switch view to plain text mode
Does anyone know how to do this?
Bookmarks