changeset 166:0442224a9553

correct bug in minimumSize when we have only one row or one column
author lbajardsilogic
date Fri, 16 Nov 2007 13:17:55 +0000
parents 1416cdbe79b6
children 2ac52ea3c1c4
files widgets/FlowLayout.cpp widgets/FlowLayout.h
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/FlowLayout.cpp	Thu Nov 15 17:21:04 2007 +0000
+++ b/widgets/FlowLayout.cpp	Fri Nov 16 13:17:55 2007 +0000
@@ -91,7 +91,7 @@
 
 QSize FlowLayout::sizeHint() const
 {
-    return minimumSize();
+	return minimumSize();
 }
 
 QSize FlowLayout::minimumSize() const
@@ -110,13 +110,15 @@
 		}
 
 		//find XMax
-		if (itemXMax->geometry().x() < item->geometry().x())
+		if ( (itemXMax->geometry().x() < item->geometry().x()) ||
+			 ( (itemXMax->geometry().x() == item->geometry().x()) && (itemXMax->geometry().width() < item->geometry().width()) ) )
 		{
 			itemXMax = item;
 		}
 
         //find YMax
-		if (itemYMax->geometry().y() < item->geometry().y())
+		if ( (itemYMax->geometry().y() < item->geometry().y()) ||
+			( (itemYMax->geometry().y() == item->geometry().y()) && (itemYMax->geometry().height() < item->geometry().height()) ) )
 		{
 			itemYMax = item;
 		}
--- a/widgets/FlowLayout.h	Thu Nov 15 17:21:04 2007 +0000
+++ b/widgets/FlowLayout.h	Fri Nov 16 13:17:55 2007 +0000
@@ -45,7 +45,7 @@
     QSize minimumSize() const;
 	void setGeometry(const QRect &rect);
     QSize sizeHint() const;
-    QLayoutItem *takeAt(int index);
+	QLayoutItem *takeAt(int index);
 
 private:
     int doLayout(const QRect &rect, bool testOnly) const;