diff options
| author | Peter Penz <[email protected]> | 2011-09-23 23:37:42 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-09-23 23:38:51 +0200 |
| commit | 9ea4d3c70c3765c1ef417642a392465caa31997c (patch) | |
| tree | 501200dfc615f61858fc96e7066b040db28123c1 /src/kitemviews/kitemlistview.h | |
| parent | 56852cff392f33ee731129fd9a755544d817e590 (diff) | |
Increase the width of the first column automatically
Additionally it is assured that on role-changes the size-hints
get updated if necessary.
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
| -rw-r--r-- | src/kitemviews/kitemlistview.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index b088ea487..75a298a1e 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -146,6 +146,12 @@ public: int firstVisibleIndex() const; int lastVisibleIndex() const; + /** + * @return Required size for the item with the index \p index. + * Per default KItemListView::itemSize() is returned. + * When reimplementing this method it is recommended to + * also reimplement KItemListView::itemSizeHintUpdateRequired(). + */ virtual QSizeF itemSizeHint(int index) const; /** @@ -194,6 +200,16 @@ signals: protected: virtual void initializeItemListWidget(KItemListWidget* item); + /** + * @return True if at least one of the changed roles \p changedRoles might result + * in the need to update the item-size hint (see KItemListView::itemSizeHint()). + * Per default true is returned which means on each role-change of existing items + * the item-size hints are recalculated. For performance reasons it is recommended + * to return false in case if a role-change will not result in a changed + * item-size hint. + */ + virtual bool itemSizeHintUpdateRequired(const QSet<QByteArray>& changedRoles) const; + virtual void onControllerChanged(KItemListController* current, KItemListController* previous); virtual void onModelChanged(KItemModelBase* current, KItemModelBase* previous); @@ -216,6 +232,16 @@ protected: QList<KItemListWidget*> visibleItemListWidgets() const; + /** + * Marks the visible roles as dirty so that they will get updated when doing the next + * layout. The visible roles will only get marked as dirty if an empty item-size is + * given and if the roles have not already been customized by the user by adjusting + * the view-header. + * @return True if the visible roles have been marked as dirty. + */ + bool markVisibleRolesSizesAsDirty(); + + /** @reimp */ virtual void resizeEvent(QGraphicsSceneResizeEvent* event); protected slots: @@ -295,14 +321,6 @@ private: void setLayouterSize(const QSizeF& size, SizeType sizeType); /** - * Marks the visible roles as dirty so that they will get updated when doing the next - * layout. The visible roles will only get marked as dirty if an empty item-size is - * given. - * @return True if the visible roles have been marked as dirty. - */ - bool markVisibleRolesSizesAsDirty(); - - /** * Updates the m_visibleRoleSizes property and applies the dynamic * size to the layouter. */ |
