┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kstandarditemmodel.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-05-01 23:11:06 +0200
committerPeter Penz <[email protected]>2012-05-01 23:14:52 +0200
commitd76b113ad10fe207ef23d5dd44c63ee076c71521 (patch)
tree2cda5384e4036f4f048392548ea75243ce6b7fc2 /src/kitemviews/kstandarditemmodel.h
parent6a7cb5ff7d29cc636b432a96e0db9ef9f9030527 (diff)
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...
Diffstat (limited to 'src/kitemviews/kstandarditemmodel.h')
-rw-r--r--src/kitemviews/kstandarditemmodel.h38
1 files changed, 37 insertions, 1 deletions
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<QByteArray, QVariant> data(int index) const;
virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
@@ -59,6 +76,25 @@ public:
virtual QString roleDescription(const QByteArray& role) const;
virtual QList<QPair<int, QVariant> > 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<KStandardItem*> m_items;
QHash<const KStandardItem*, int> m_indexesForItems;