I wanted to copy a QStringList to another QStringList but only taking the odd positions.
Code:
. . .
Someone has idea?
Thanks.
Printable View
I wanted to copy a QStringList to another QStringList but only taking the odd positions.
Code:
. . .
Someone has idea?
Thanks.
Hi,
Use something similar to this:
Code:
int i=0; int j=1; while (i<im.count()) { pa[j] = im[i]; i++; j +=2; }
Not tested
You have to resize the list or use append() to insert items and the indexes of the list have to be a sequence. If you want only odd index numbers, use QMap.
Do you have console support enabled? I suggest using QMessageBox instead of cout to be sure.