Overwiew Layout fixup

.. the renumbering of columns removed empty columns. This was not
   desirable since in some instances where spanning tiles are used
   the user may have deliberately done this.

.. thanks to Alan Benstead at the forums for an example chart to
   test this fix against.
This commit is contained in:
Mark Liversedge
2021-11-04 09:21:41 +00:00
parent 320cddb1e1
commit 655fb69b42

View File

@@ -397,6 +397,9 @@ QList<LayoutChartSpaceItem> ChartSpace::layoutItems()
QList<LayoutChartSpaceItem> items;
foreach(ChartSpaceItem *item, this->items) items << LayoutChartSpaceItem(item);
// nothing to layout
if (items.count() == 0) return items;
//fprintf(stderr, "BEFORE: ");
//foreach(LayoutChartSpaceItem item, items) fprintf(stderr, "%d:%d ", item.column, item.order);
//fprintf(stderr, "\n"); fflush(stderr);
@@ -422,13 +425,8 @@ repeatlayout:
// can get out of whack when last entry
// from column 0 is dragged across to the right
// bit of a hack but easier to fix here
int nextcol=-1;
int lastcol=-99;
for(int i=0; i<items.count(); i++) {
if (items[i].column != lastcol) nextcol++;
lastcol=items[i].column;
items[i].column = nextcol;
}
int diff=items[0].column;
for(int i=0; i<items.count(); i++) items[i].column -= diff;
//fprintf(stderr, "RENUMBER: ");
//foreach(LayoutChartSpaceItem item, items) fprintf(stderr, "%d:%d ", item.column, item.order);