Added alternative way to notify FeedsView about changes.
This commit is contained in:
parent
15db836b46
commit
1e7bf0ef9e
@ -173,9 +173,28 @@ FeedsModelRootItem *FeedsModel::itemForIndex(const QModelIndex &index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::changeLayout() {
|
void FeedsModel::changeLayout(QModelIndexList list) {
|
||||||
|
// TODO: Udělat analyzu pres cachegrind
|
||||||
|
// esli je lepsi tohle, nebo zakomentovana cast
|
||||||
|
// zakomentovana cast udela to ze view se dopta na všecky
|
||||||
|
// polozky
|
||||||
|
|
||||||
|
while (!list.isEmpty()) {
|
||||||
|
QModelIndex ix = list.takeLast();
|
||||||
|
emit dataChanged(index(ix.row(), 0, ix.parent()),
|
||||||
|
index(ix.row(), FDS_MODEL_COUNTS_INDEX, ix.parent()));
|
||||||
|
if (ix.parent().isValid()) {
|
||||||
|
list.append(ix.parent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
|
// TODO: kouknout do dokumentace na signal layoutChanged,
|
||||||
|
// protoze ten signal layoutAboutToBeChanged by se měl volat PRED
|
||||||
|
// zmenou dat v modelu
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsModel::loadFromDatabase() {
|
void FeedsModel::loadFromDatabase() {
|
||||||
|
@ -52,7 +52,7 @@ class FeedsModel : public QAbstractItemModel {
|
|||||||
public slots:
|
public slots:
|
||||||
// Signals that ALL data of this model need
|
// Signals that ALL data of this model need
|
||||||
// to be reloaded by ALL attached views.
|
// to be reloaded by ALL attached views.
|
||||||
void changeLayout();
|
void changeLayout(QModelIndexList list);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Loads feed/categories from the database.
|
// Loads feed/categories from the database.
|
||||||
|
@ -34,7 +34,7 @@ void FeedsView::updateCountsOfSelectedFeeds() {
|
|||||||
feed->updateCounts();
|
feed->updateCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sourceModel->changeLayout();
|
m_sourceModel->changeLayout(mapped_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::setupAppearance() {
|
void FeedsView::setupAppearance() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user