┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-02-05 19:14:17 +0100
committerPeter Penz <[email protected]>2012-02-05 19:22:34 +0100
commit7af39fb960352e0504153c627db0615d80758ebe (patch)
tree93427542fb54d7ea854d82d09b72a3ddc7b5b8bb /src/kitemviews/kitemlistview.h
parentd0933155e2dc179cde49b4306ff7feee9ca47697 (diff)
Fix potential endless loop in layout
Usecase: - No scrollbar is shown - Window size will be decreased so that a scrollbar gets necessary The decreased window size minus the space required for the scrollbar results in a relayout of the items. In 99 % of all cases a decreased window size won't result in showing more items in parallel in comparison to a larger window size. However in the remaining 1 % this can happen (e.g. see bug 293318 for a sample). This results in an endless loop as now no scrollbar is required anymore, the layout changes again, the scrollbar is required again, ... BUG: 293318 FIXED-IN: 4.8.1
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
-rw-r--r--src/kitemviews/kitemlistview.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index 9c34daba3..e675df221 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -462,6 +462,13 @@ private:
bool animateChangedItemCount(int changedItemCount) const;
/**
+ * @return True if a scrollbar for the given scroll-orientation is required
+ * when using a size of \p size for the view. Calling the method is rather
+ * expansive as a temporary relayout needs to be done.
+ */
+ bool scrollBarRequired(const QSizeF& size) const;
+
+ /**
* Helper function for triggerAutoScrolling().
* @param pos Logical position of the mouse relative to the range.
* @param range Range of the visible area.
@@ -512,6 +519,7 @@ private:
KItemListHeader* m_header;
bool m_useHeaderWidths;
+ friend class KItemListContainer; // Accesses scrollBarRequired()
friend class KItemListController;
friend class KItemListControllerTest;
};