mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-10 15:22:30 +01:00
Some refactorings for feed view.
This commit is contained in:
parent
86c22db046
commit
046322fa9d
@ -27,6 +27,13 @@ void FeedsView::setSortingEnabled(bool enable) {
|
||||
header()->setSortIndicatorShown(false);
|
||||
}
|
||||
|
||||
QList<FeedsModelFeed *> FeedsView::selectedFeeds() const {
|
||||
QModelIndexList selection = selectionModel()->selectedRows();
|
||||
QModelIndexList mapped_selection = m_proxyModel->mapListToSource(selection);
|
||||
|
||||
return m_sourceModel->feedsForIndexes(mapped_selection);
|
||||
}
|
||||
|
||||
void FeedsView::updateCountsOfSelectedFeeds() {
|
||||
QModelIndexList selected_rows = selectionModel()->selectedRows();
|
||||
QModelIndexList mapped_rows = m_proxyModel->mapListToSource(selected_rows);
|
||||
@ -65,9 +72,7 @@ void FeedsView::selectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected) {
|
||||
QTreeView::selectionChanged(selected, deselected);
|
||||
|
||||
QModelIndexList selection = selectionModel()->selectedRows();
|
||||
QModelIndexList mapped_selection = m_proxyModel->mapListToSource(selection);
|
||||
QList<FeedsModelFeed*> selected_feeds = m_sourceModel->feedsForIndexes(mapped_selection);
|
||||
QList<FeedsModelFeed*> selected_feeds = selectedFeeds();
|
||||
QList<int> feed_ids;
|
||||
|
||||
foreach (FeedsModelFeed *feed, selected_feeds) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
class FeedsModel;
|
||||
class FeedsProxyModel;
|
||||
class FeedsModelFeed;
|
||||
|
||||
class FeedsView : public QTreeView {
|
||||
Q_OBJECT
|
||||
@ -17,6 +18,8 @@ class FeedsView : public QTreeView {
|
||||
|
||||
void setSortingEnabled(bool enable);
|
||||
|
||||
QList<FeedsModelFeed*> selectedFeeds() const;
|
||||
|
||||
public slots:
|
||||
// Reloads count for selected feeds.
|
||||
void updateCountsOfSelectedFeeds();
|
||||
|
Loading…
Reference in New Issue
Block a user