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);
|
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() {
|
void FeedsView::updateCountsOfSelectedFeeds() {
|
||||||
QModelIndexList selected_rows = selectionModel()->selectedRows();
|
QModelIndexList selected_rows = selectionModel()->selectedRows();
|
||||||
QModelIndexList mapped_rows = m_proxyModel->mapListToSource(selected_rows);
|
QModelIndexList mapped_rows = m_proxyModel->mapListToSource(selected_rows);
|
||||||
@ -65,9 +72,7 @@ void FeedsView::selectionChanged(const QItemSelection &selected,
|
|||||||
const QItemSelection &deselected) {
|
const QItemSelection &deselected) {
|
||||||
QTreeView::selectionChanged(selected, deselected);
|
QTreeView::selectionChanged(selected, deselected);
|
||||||
|
|
||||||
QModelIndexList selection = selectionModel()->selectedRows();
|
QList<FeedsModelFeed*> selected_feeds = selectedFeeds();
|
||||||
QModelIndexList mapped_selection = m_proxyModel->mapListToSource(selection);
|
|
||||||
QList<FeedsModelFeed*> selected_feeds = m_sourceModel->feedsForIndexes(mapped_selection);
|
|
||||||
QList<int> feed_ids;
|
QList<int> feed_ids;
|
||||||
|
|
||||||
foreach (FeedsModelFeed *feed, selected_feeds) {
|
foreach (FeedsModelFeed *feed, selected_feeds) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
class FeedsModel;
|
class FeedsModel;
|
||||||
class FeedsProxyModel;
|
class FeedsProxyModel;
|
||||||
|
class FeedsModelFeed;
|
||||||
|
|
||||||
class FeedsView : public QTreeView {
|
class FeedsView : public QTreeView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -17,6 +18,8 @@ class FeedsView : public QTreeView {
|
|||||||
|
|
||||||
void setSortingEnabled(bool enable);
|
void setSortingEnabled(bool enable);
|
||||||
|
|
||||||
|
QList<FeedsModelFeed*> selectedFeeds() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Reloads count for selected feeds.
|
// Reloads count for selected feeds.
|
||||||
void updateCountsOfSelectedFeeds();
|
void updateCountsOfSelectedFeeds();
|
||||||
|
Loading…
Reference in New Issue
Block a user