void QOrganizerManager::createEngine(const QString& managerName, const QMap<QString, QString>& parameters) { d->createEngine(managerName, parameters); connect(d->m_engine, SIGNAL(dataChanged()), this, SIGNAL(dataChanged())); connect(d->m_engine, SIGNAL(itemsAdded(QList<QOrganizerItemId>)), this, SIGNAL(itemsAdded(QList<QOrganizerItemId>))); connect(d->m_engine, SIGNAL(itemsChanged(QList<QOrganizerItemId>)), this, SIGNAL(itemsChanged(QList<QOrganizerItemId>))); connect(d->m_engine, SIGNAL(itemsRemoved(QList<QOrganizerItemId>)), this, SIGNAL(itemsRemoved(QList<QOrganizerItemId>))); connect(d->m_engine, SIGNAL(collectionsAdded(QList<QOrganizerCollectionId>)), this, SIGNAL(collectionsAdded(QList<QOrganizerCollectionId>))); connect(d->m_engine, SIGNAL(collectionsChanged(QList<QOrganizerCollectionId>)), this, SIGNAL(collectionsChanged(QList<QOrganizerCollectionId>))); connect(d->m_engine, SIGNAL(collectionsRemoved(QList<QOrganizerCollectionId>)), this, SIGNAL(collectionsRemoved(QList<QOrganizerCollectionId>))); connect(d->m_engine, SIGNAL(itemsChanged(QList<QOrganizerItemId>)), this, SLOT(_q_itemsUpdated(QList<QOrganizerItemId>))); connect(d->m_engine, SIGNAL(itemsRemoved(QList<QOrganizerItemId>)), this, SLOT(_q_itemsDeleted(QList<QOrganizerItemId>))); }
void KStandardItemModel::clear() { int size = m_items.size(); m_items.clear(); m_indexesForItems.clear(); emit itemsRemoved(KItemRangeList() << KItemRange(0, size)); }
/*! * Removes the number of items specified by \a removeCount starting at the * position \a index. Attempting to remove items past the end of * the array does nothing. */ void QScatterDataProxy::removeItems(int index, int removeCount) { if (index >= dptr()->m_dataArray->size()) return; dptr()->removeItems(index, removeCount); emit itemsRemoved(index, removeCount); emit itemCountChanged(itemCount()); }
KAbstractTreeModel* KTreeWidgetPrivate::setModel( KAbstractTreeModel *model ) { Q_Q(KTreeWidget); KAbstractTreeModel *modelOld = m_model; if(m_model) { QObject::disconnect(m_model, SIGNAL(itemsInserted(QList<qint64>)), q, SLOT(on_model_itemsInserted(QList<qint64>))); QObject::disconnect(m_model, SIGNAL(itemsRemoved(QList<qint64>)), q, SLOT(on_model_itemsRemoved(QList<qint64>))); QObject::disconnect(m_model, SIGNAL(itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>)), q, SLOT(on_model_itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>))); QObject::disconnect(m_model, SIGNAL(modelReset()), q, SLOT(on_model_modelReset())); } m_model = model; QObject::connect(m_model, SIGNAL(itemsInserted(QList<qint64>)), q, SLOT(on_model_itemsInserted(QList<qint64>))); QObject::connect(m_model, SIGNAL(itemsRemoved(QList<qint64>)), q, SLOT(on_model_itemsRemoved(QList<qint64>))); QObject::connect(m_model, SIGNAL(itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>)), q, SLOT(on_model_itemsChanged(QList<qint64>,QList<Qt::ItemDataRole>))); QObject::connect(m_model, SIGNAL(modelReset()), q, SLOT(on_model_modelReset())); return modelOld; }
/*! \qmlmethod ListModel::clear() Deletes all content from the model. \sa append() remove() */ void QDeclarativeListModel::clear() { int cleared = count(); if (m_flat) m_flat->clear(); else m_nested->clear(); if (!inWorkerThread()) { emit itemsRemoved(0, cleared); emit countChanged(); } }
void RecentFileModel::setRecentFiles(const QStringList &filePaths) { QStringList oldPaths = m_paths; m_paths.clear(); if (oldPaths.size() > 0) { emit itemsRemoved(0, oldPaths.size()); } m_paths = filePaths; if (m_paths.size() > 0) { emit itemsInserted(0, m_paths.size()); } }
/*! \qmlmethod ListModel::remove(int index) Deletes the content at \a index from the model. \sa clear() */ void QDeclarativeListModel::remove(int index) { if (index < 0 || index >= count()) { qmlInfo(this) << tr("remove: index %1 out of range").arg(index); return; } if (m_flat) m_flat->remove(index); else m_nested->remove(index); if (!inWorkerThread()) { emit itemsRemoved(index, 1); emit countChanged(); } }
int QtListModelInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: itemsInserted((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 1: itemsRemoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 2: itemsMoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 3: itemsChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< const QList<QByteArray>(*)>(_a[3]))); break; default: ; } _id -= 4; } return _id; }
void OptimizeHosts( __inout IPAddressMap & f_cache) { assert( IsSubDomain( "test.64happy1000loans.com", "64happy1000loans.com" ) ); std::cout << "Optimizing Entries...." << std::endl; size_t itemsRemovedLast(0); size_t itemsRemoved(0); DomainNames setDomainNames( OptimizeUniqueDomainNames( ExtractUniqueDomainNamesReverse( f_cache ) ) ); std::cout << "-- Removing subdomains: Start" << std::endl; IPAddressMap::iterator const itCacheEnd( f_cache.end() ); int pass(0); do { itemsRemovedLast = itemsRemoved; IPAddressMap::iterator itCacheItem( f_cache.begin() ); while( itCacheEnd != itCacheItem ) { if( IsBlockedIp(itCacheItem->first) && IsSubdomainOfBlockedEntry( itCacheItem->second, setDomainNames ) ) { ++itemsRemoved; itCacheItem = RemoveItemAndMoveToNext( f_cache, itCacheItem ); } else { ++itCacheItem; } } std::cout << " ++ Pass " << ++pass << " Removed " << ( itemsRemoved - itemsRemovedLast ) << " Entries." << std::endl; } while( itemsRemovedLast != itemsRemoved ); std::cout << "-- Removing subdomains: End" << std::endl; std::cout << "Optimizing Complete. Removed " << itemsRemoved << " Entries." << std::endl; }
void KStandardItemModel::removeItem(int index) { if (index >= 0 && index < count()) { KStandardItem* item = m_items[index]; m_indexesForItems.remove(item); m_items.removeAt(index); // Removing an item requires to update the indexes // afterwards from m_indexesForItems. for (int i = index; i < m_items.count(); ++i) { m_indexesForItems.insert(m_items[i], i); } onItemRemoved(index, item); delete item; item = 0; emit itemsRemoved(KItemRangeList() << KItemRange(index, 1)); // TODO: no hierarchical items are handled yet } }