Top Align...let items be as large as they can be.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=772740
This commit is contained in:
parent
cc8024c991
commit
9906e6746d
@ -189,7 +189,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 = floor( ((rectHeight - space) / i - space) );
|
rowHeight = rectHeight / i;
|
||||||
rowCnt = i;
|
rowCnt = i;
|
||||||
colCnt = (int)(usedSpace / colWidth);
|
colCnt = (int)(usedSpace / colWidth);
|
||||||
}
|
}
|
||||||
@ -198,10 +198,9 @@ void FlowLayout::relayout()
|
|||||||
//make items fit in available space
|
//make items fit in available space
|
||||||
if( colWidth == 0) {
|
if( colWidth == 0) {
|
||||||
colCnt = (int)ceil((qreal)(count + (count % 2)) / rowMax);
|
colCnt = (int)ceil((qreal)(count + (count % 2)) / rowMax);
|
||||||
// use floor incase we get into repeating decimal situation (that breaks things..I think)
|
colWidth = rectWidth / colCnt;
|
||||||
colWidth = floor(rectWidth / colCnt);
|
|
||||||
rowCnt = (count + (count % 2)) / colCnt;
|
rowCnt = (count + (count % 2)) / colCnt;
|
||||||
rowHeight = floor( ( ( rectHeight - space ) / rowCnt ) - space );
|
rowHeight = rectHeight / rowCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//kDebug() << "colWidth: " << colWidth << "rowHeight: " << rowHeight
|
//kDebug() << "colWidth: " << colWidth << "rowHeight: " << rowHeight
|
||||||
@ -210,19 +209,19 @@ void FlowLayout::relayout()
|
|||||||
|
|
||||||
// lay the items out in left-to-right , top-to-bottom order
|
// lay the items out in left-to-right , top-to-bottom order
|
||||||
int insertColumn = 0;
|
int insertColumn = 0;
|
||||||
qreal rowPos = space;
|
qreal rowPos = 0;
|
||||||
foreach(LayoutItem *item , d->items) {
|
foreach(LayoutItem *item , d->items) {
|
||||||
|
|
||||||
if(insertColumn >= colCnt) {
|
if(insertColumn >= colCnt) {
|
||||||
insertColumn = 0;
|
insertColumn = 0;
|
||||||
rowPos += (rowHeight + space);
|
rowPos += rowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// position the item
|
// position the item
|
||||||
const QRectF newGeometry(rect.left() + (insertColumn * colWidth),
|
const QRectF newGeometry(rect.left() + (insertColumn * colWidth),
|
||||||
rect.top() + rowPos,
|
rect.top() + rowPos,
|
||||||
colWidth - space,
|
colWidth - space,
|
||||||
rowHeight);
|
rowHeight - space);
|
||||||
|
|
||||||
//kDebug() << "newGeometry: " << newGeometry;
|
//kDebug() << "newGeometry: " << newGeometry;
|
||||||
insertColumn++;
|
insertColumn++;
|
||||||
|
Loading…
Reference in New Issue
Block a user