Fill unused space on bottom row.

Thanks Marco Martin

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=773435
This commit is contained in:
Bill Egert 2008-02-11 01:32:00 +00:00
parent 783872cc77
commit 77412f9c5b

View File

@ -187,7 +187,7 @@ void FlowLayout::relayout()
for(int i = 1; (i <= rowMax) && (colWidth == 0); i++) { for(int i = 1; (i <= rowMax) && (colWidth == 0); i++) {
if( i * (usedSpace / maxItemWidth ) >= count) { if( i * (usedSpace / maxItemWidth ) >= count) {
colWidth = maxItemWidth; colWidth = maxItemWidth;
rowHeight = rectHeight / i; rowHeight = (rectHeight + space) / i;
rowCnt = i; rowCnt = i;
colCnt = (int)(usedSpace / colWidth); colCnt = (int)(usedSpace / colWidth);
} }
@ -208,7 +208,12 @@ void FlowLayout::relayout()
} }
rowCnt = (int)ceil((qreal)count / colCnt); rowCnt = (int)ceil((qreal)count / colCnt);
colWidth = rectWidth / colCnt; colWidth = rectWidth / colCnt;
rowHeight = rectHeight / rowCnt; rowHeight = (rectHeight + space) / rowCnt;
}
if( minItemHeight > (rowHeight - space) ) {
rowHeight = minItemHeight + space;
} }
//kDebug() << "colWidth: " << colWidth << "rowHeight: " << rowHeight //kDebug() << "colWidth: " << colWidth << "rowHeight: " << rowHeight