[Kst] [Bug 125873] Improvements to the "ordered" datawizard

Andrew Walker arwalker at sumusltd.com
Tue May 2 20:18:34 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=125873         




------- Additional Comments From arwalker sumusltd com  2006-05-02 20:18 -------
There are at least a couple of problems with the following piece of code from datawizard.ui.h:

    // Reorder the vectors if the user wants it
    if (_orderInColumns) {
	const KstVectorList lOld = l;
	const int count = lOld.count();
	const int cols = signed(sqrt(plots.count()));
	int row = 0, col = 0;
	for (int i = 0; i < count; ++i) {
	    l[row * cols + col] = lOld[i];
	    ++row;
	    if (row >= cols) {
		++col;
		row = 0;
	    }
	}
    }

1) _orderInColumns is a widget and so will always be non-NULL. This should probably read _orderInColumns->isChecked() so that the vectors are only re-ordered if the box is checked
2) the index of l calculated by l[row * cols + col] does not map one-to-one.
If we assume (for example) that cols = 2 then we get the sequence 0 2 1 3 2 4,
which causes the problem decribed by Nicholas.


More information about the Kst mailing list