Hi
I found a bug in the handling of column removal by headerview.
I found also the code error that give that mishandling.
The case :
3 columns, say A, B, C.
Move column C to first place. -> C,A,B.
Then remove column A -> Boom. Normally should get C,B
the current code :
for (int l = logicalLast; l >= logicalFirst; --l) {
int visual = visualIndices.at(l);
int size = sections.at(visual + 1).position - sections.at(visual).position;
for (int v = 0; v < sections.count(); ++v) {
if (logicalIndex(v) > l)
--(logicalIndices[v]);
if (v > visual) {
sections[v].position -= size;
int logical = logicalIndex(v);
--(visualIndices[logical]);
}
}
sections.remove(visual);
hiddenSectionSize.remove(l);
logicalIndices.remove(visual);
visualIndices.remove(l);
for (int l = logicalLast; l >= logicalFirst; --l) {
int visual = visualIndices.at(l);
int size = sections.at(visual + 1).position - sections.at(visual).position;
for (int v = 0; v < sections.count(); ++v) {
if (logicalIndex(v) > l)
--(logicalIndices[v]);
if (v > visual) {
sections[v].position -= size;
int logical = logicalIndex(v);
--(visualIndices[logical]);
}
}
sections.remove(visual);
hiddenSectionSize.remove(l);
logicalIndices.remove(visual);
visualIndices.remove(l);
To copy to clipboard, switch view to plain text mode
line 9/10 use value that line 7 may have changed.
it should be (80% sure
) :
for (int l = logicalLast; l >= logicalFirst; --l) {
int visual = visualIndices.at(l);
int size = sections.at(visual + 1).position - sections.at(visual).position;
for (int v = 0; v < sections.count(); ++v) {
int logical = logicalIndex(v);
if (logicalIndex(v) > l)
--(logicalIndices[v]);
if (v > visual) {
sections[v].position -= size;
--(visualIndices[logical]);
}
}
sections.remove(visual);
hiddenSectionSize.remove(l);
logicalIndices.remove(visual);
visualIndices.remove(l);
for (int l = logicalLast; l >= logicalFirst; --l) {
int visual = visualIndices.at(l);
int size = sections.at(visual + 1).position - sections.at(visual).position;
for (int v = 0; v < sections.count(); ++v) {
int logical = logicalIndex(v);
if (logicalIndex(v) > l)
--(logicalIndices[v]);
if (v > visual) {
sections[v].position -= size;
--(visualIndices[logical]);
}
}
sections.remove(visual);
hiddenSectionSize.remove(l);
logicalIndices.remove(visual);
visualIndices.remove(l);
To copy to clipboard, switch view to plain text mode
What is the quickest way to get an official fix for that ?
I'm trying to recollect how to recompile Qt here 
(I have already done it for 4.1.2)
Thanks.
Bookmarks