diff options
Diffstat (limited to 'lib/bookmarks/model')
-rw-r--r-- | lib/bookmarks/model/bookmarkmodel.cpp | 7 | ||||
-rw-r--r-- | lib/bookmarks/model/bookmarkmodel.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/bookmarks/model/bookmarkmodel.cpp b/lib/bookmarks/model/bookmarkmodel.cpp index aa8b0ac..977248c 100644 --- a/lib/bookmarks/model/bookmarkmodel.cpp +++ b/lib/bookmarks/model/bookmarkmodel.cpp @@ -104,6 +104,13 @@ bool BookmarkModel::isItemExpanded(const QModelIndex &index) const return static_cast<BookmarkItem *>(index.internalPointer())->isExpanded(); } +void BookmarkModel::setItemExpanded(const QModelIndex& index, bool expanded) +{ + BookmarkItem *item = getItem(index); + if(item->type() == BookmarkItem::Folder) + item->setExpanded(expanded); +} + int BookmarkModel::rowCount(const QModelIndex &index) const { if(index.column() > 0) diff --git a/lib/bookmarks/model/bookmarkmodel.h b/lib/bookmarks/model/bookmarkmodel.h index 4da2f9c..3e0f35e 100644 --- a/lib/bookmarks/model/bookmarkmodel.h +++ b/lib/bookmarks/model/bookmarkmodel.h @@ -28,6 +28,7 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const override; bool isItemExpanded(const QModelIndex &index) const; + void setItemExpanded(const QModelIndex &index, bool expanded); int rowCount(const QModelIndex &index) const override; QModelIndex appendBookmark(const QString &title, const QString &url, const QModelIndex &parent); |