From d76b113ad10fe207ef23d5dd44c63ee076c71521 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 1 May 2012 23:11:06 +0200 Subject: Places Panel: Allow hiding of items Related changes: - Animate changed items for the details-view in case it is not expandable - Remove the hardcoded "isHidden"-code in KStandardItemListWidget and allow derived widgets to define themselves what means "hidden" within their context. The current code needs a lot of bugfixing, but lets make this in smaller steps during the next days... --- src/kitemviews/kstandarditemmodel.h | 38 ++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/kstandarditemmodel.h') diff --git a/src/kitemviews/kstandarditemmodel.h b/src/kitemviews/kstandarditemmodel.h index 5cf60085b..d1a036fd0 100644 --- a/src/kitemviews/kstandarditemmodel.h +++ b/src/kitemviews/kstandarditemmodel.h @@ -43,13 +43,30 @@ public: explicit KStandardItemModel(QObject* parent = 0); virtual ~KStandardItemModel(); + /** + * Inserts the item \a item at the index \a index. If the index + * is equal to the number of items of the model, the item + * gets appended as last element. KStandardItemModel takes + * the ownership of the item. + */ void insertItem(int index, KStandardItem* item); + + /** + * Replaces the item on the index \a index by \a item. + * KStandardItemModel takes the ownership of the item. The + * old item gets deleted. + */ void replaceItem(int index, KStandardItem* item); - void appendItem(KStandardItem* item); + void removeItem(int index); KStandardItem* item(int index) const; int index(const KStandardItem* item) const; + /** + * Convenience method for insertItem(count(), item). + */ + void appendItem(KStandardItem* item); + virtual int count() const; virtual QHash data(int index) const; virtual bool setData(int index, const QHash& values); @@ -59,6 +76,25 @@ public: virtual QString roleDescription(const QByteArray& role) const; virtual QList > groups() const; +protected: + /** + * Is invoked after an item has been inserted and before the signal + * itemsInserted() gets emitted. + */ + virtual void onItemInserted(int index); + + /** + * Is invoked after an item has been replaced and before the signal + * itemsChanged() gets emitted. + */ + virtual void onItemReplaced(int index); + + /** + * Is invoked after an item has been removed and before the signal + * itemsRemoved() gets emitted. + */ + virtual void onItemRemoved(int index); + private: QList m_items; QHash m_indexesForItems; -- cgit v1.3.1