Cerberus
11th October 2015, 21:59
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 |
----------------------
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
Does anyone know how to do this?
The datasets I get have two columns:
| msg | ownership |
----------------------
| test1 | 0 |
| test2 | 1 |
| test3 | 1 |
| test4 | 0 |
----------------------
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
Does anyone know how to do this?