Unsolved Convert values in QListView
-
Hi!
My QListView after SQL query has that list:
40
40002F
40231S
40297SAnd I want to convert all values that begin at 40 to 40, without duplication, so it should be:
40Can you help me?
-
Can anybody help?
-
Hi,
Please practice some patience, allow 24 hours before bumping your own thread. This is a community driven forum and not everybody lives in the same timezone as you.
As for your question, what do you mean by convert ? Do you want to only show 40 to the users or do you want to modify the database itself.
If the former, then you can implement a simple QStyledItemDelegate subclass and re-implement the displayText method to only return the two first digits.
Hope it helps.
-
@SGaist with sql query i can change values in one column. But it's the third column. The second shows month. In the first column are numbers.
The structure is:
Number, Month, CodeExample. Was:
200 02 04-03
30 02 04-04
10 03 04-05Now:
200 02 04
30 02 04
10 03 04But the result should be (Sum, month, code):
230 02 04
10 03 04How to make function like that:
if in the second and third columns of QTableView, values are the same, then make sum numbers in first column and make one line with that sum, month and a unique number. -
Isn't that the same question as here ?
-
@SGaist yes, it is.
-
In that case this one should be closed since the other one explain the problem directly.