/*! * Adds the item \a item to the end of the array. * * Returns the index of the added item. */ int QScatterDataProxy::addItem(const QScatterDataItem &item) { int addIndex = dptr()->addItem(item); emit itemsAdded(addIndex, 1); emit itemCountChanged(itemCount()); return addIndex; }
/*! * Adds the items specified by \a items to the end of the array. * * Returns the index of the first added item. */ int QScatterDataProxy::addItems(const QScatterDataArray &items) { int addIndex = dptr()->addItems(items); emit itemsAdded(addIndex, items.size()); emit itemCountChanged(itemCount()); return addIndex; }
void QObjectListModel::removeItem(int index) { beginRemoveRows(QModelIndex(), index, index); disconnect(((QObject*)_list->at(index)), SIGNAL(destroyed()), this, SLOT(removeDestroyedItem())); _list->removeAt(index); endRemoveRows(); emit itemCountChanged(); }
/*! * Takes ownership of the array \a newArray. Clears the existing array if the * new array differs from it. If the arrays are the same, this function * just triggers the arrayReset() signal. * * Passing a null array deletes the old array and creates a new empty array. */ void QScatterDataProxy::resetArray(QScatterDataArray *newArray) { if (dptr()->m_dataArray != newArray) dptr()->resetArray(newArray); emit arrayReset(); emit itemCountChanged(itemCount()); }
/*! * 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()); }
void QObjectListModel::setList(QList<QObject *> *list) { QList<QObject *> *oldList = _list; beginResetModel(); _list = list; endResetModel(); emit itemCountChanged(); delete oldList; }
void QObjectListModel::insertItem(int index, QObject *item) { beginInsertRows(QModelIndex(), index, index); _list->insert(index, item); connect(item, SIGNAL(destroyed()), this, SLOT(removeDestroyedItem())); endInsertRows(); emit itemAdded(item); emit itemCountChanged(); }
void QObjectListModel::removeItem(QObject *item) { int index = _list->indexOf(item); if (index >= 0) { beginRemoveRows(QModelIndex(), index, index); _list->removeAt(index); disconnect(item, SIGNAL(destroyed()), this, SLOT(removeDestroyedItem())); endRemoveRows(); emit itemCountChanged(); } }
void QObjectListModel::addItem(QObject *item) { int z = _list->count(); beginInsertRows(QModelIndex(), z, z); _list->append(item); connect(item, SIGNAL(destroyed()), this, SLOT(removeDestroyedItem())); endInsertRows(); emit itemAdded(item); emit itemCountChanged(); }
void WindowModel::remItem(int id) { if (!m_complete) return; int idx = m_items.indexOf(id); if (idx == -1) return; beginRemoveRows(QModelIndex(), idx, idx); m_items.removeAt(idx); endRemoveRows(); emit itemCountChanged(); }
void WindowModel::addItem(int id) { if (!m_complete) return; LipstickCompositor *c = LipstickCompositor::instance(); LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(c->windowForId(id)); if (!approveWindow(window)) return; beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); m_items.append(id); endInsertRows(); emit itemAdded(m_items.count() - 1); emit itemCountChanged(); }
void CDoodMemberManager::onMemberListChanged(QString operType, QString GroupId, MemberList memberlist) { qDebug() << Q_FUNC_INFO<<"sss"; if(operType=="32"||operType=="33"){ for(size_t i=0;i<memberlist.size();++i){ qDebug() << Q_FUNC_INFO<<"sss1"<<memberlist[i].id<<memberlist[i].name; CDoodMemberItem *item = memberListMap.value(memberlist[i].id,NULL); if(item!=NULL){ qDebug() << Q_FUNC_INFO<<"sss2"; if(item->groupid()==GroupId){ qDebug() << Q_FUNC_INFO<<"sss3"; removeMemberItem(memberlist[i].id); int size; size=memberSize().toInt()-1; setMemberSize(QString::number(size)); } } item=groupAdminListMap.value(memberlist[i].id,NULL); if(item!=NULL){ if(memberlist[i].groupid==GroupId){ removeMemberItem(memberlist[i].id); int size; size=memberSize().toInt()-1; setMemberSize(QString::number(size)); } } } } if(operType=="1"){ if(GroupId==mGroupid){ for(size_t i=0;i<memberlist.size();++i){ addMember(memberlist[i]); emit itemCountChanged(); } int size; size=memberSize().toInt()+memberlist.size(); setMemberSize(QString::number(size)); } } }
void CDoodMemberManager::onGetMemberListResult(QString result, MemberList memberList) { if(result=="获取成员列表成功"){ if(memberList.size()>0){ if(memberList[0].groupid==m_ThePresentGroupid){ setMemberSize(QString::number(memberList.size())); mMy_Id=getMyId(); setMy_Type("1"); for(size_t i=0;i<memberList.size();i++) { mGroupid=memberList[0].groupid; addMember(memberList[i]); emit itemCountChanged(); } emit getMemberListResult("获取成员列表成功"); } } } else{ emit getMemberListResult("获取成员列表失败"); } }
void QObjectListModel::reset() { QAbstractListModel::reset(); emit itemCountChanged(); }
DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : QWidget(parent), m_topLayout(0), m_urlNavigator(0), m_searchBox(0), m_view(0), m_filterBar(0), m_statusBar(0), m_statusBarTimer(0), m_statusBarTimestamp() { hide(); m_topLayout = new QVBoxLayout(this); m_topLayout->setSpacing(0); m_topLayout->setMargin(0); m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this); connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl&, QDropEvent*)), this, SLOT(dropUrls(const KUrl&, QDropEvent*))); connect(m_urlNavigator, SIGNAL(activated()), this, SLOT(activate())); connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)), this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion))); const GeneralSettings* settings = DolphinSettings::instance().generalSettings(); m_urlNavigator->setUrlEditable(settings->editableUrl()); m_urlNavigator->setShowFullPath(settings->showFullPath()); m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl())); KUrlComboBox* editor = m_urlNavigator->editor(); editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode())); m_searchBox = new DolphinSearchBox(this); m_searchBox->hide(); connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox())); connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(startSearching(QString))); connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus())); m_view = new DolphinView(url, this); connect(m_view, SIGNAL(urlChanged(const KUrl&)), m_urlNavigator, SLOT(setUrl(const KUrl&))); connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool))); connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem))); connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); connect(m_view, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); connect(m_view, SIGNAL(itemTriggered(KFileItem)), this, SLOT(slotItemTriggered(KFileItem))); connect(m_view, SIGNAL(redirection(KUrl, KUrl)), this, SLOT(redirect(KUrl, KUrl))); connect(m_view, SIGNAL(startedPathLoading(KUrl)), this, SLOT(slotStartedPathLoading())); connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotFinishedPathLoading())); connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate())); connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateProgress(int))); connect(m_view, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); connect(m_view, SIGNAL(urlIsFileError(const KUrl&)), this, SLOT(openFile(const KUrl&))); connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)), this, SLOT(delayedStatusBarUpdate())); connect(m_view, SIGNAL(operationCompletedMessage(const QString&)), this, SLOT(showOperationCompletedMessage(const QString&))); connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), this, SLOT(slotUrlNavigatorLocationChanged(const KUrl&))); connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(const KUrl&)), this, SLOT(saveViewState())); connect(m_urlNavigator, SIGNAL(historyChanged()), this, SLOT(slotHistoryChanged())); // initialize status bar m_statusBar = new DolphinStatusBar(this, m_view); connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopLoading())); m_statusBarTimer = new QTimer(this); m_statusBarTimer->setSingleShot(true); m_statusBarTimer->setInterval(300); connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self(); connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)), this, SLOT(delayedStatusBarUpdate())); // initialize filter bar m_filterBar = new FilterBar(this); m_filterBar->setVisible(settings->filterBar()); connect(m_filterBar, SIGNAL(filterChanged(const QString&)), this, SLOT(setNameFilter(const QString&))); connect(m_filterBar, SIGNAL(closeRequest()), this, SLOT(closeFilterBar())); connect(m_view, SIGNAL(urlChanged(const KUrl&)), m_filterBar, SLOT(clear())); m_topLayout->addWidget(m_urlNavigator); m_topLayout->addWidget(m_searchBox); m_topLayout->addWidget(m_view); m_topLayout->addWidget(m_filterBar); m_topLayout->addWidget(m_statusBar); setSearchModeEnabled(isSearchUrl(url)); }
/*! * Inserts the items specified by \a items to the position \a index. If the * index is equal to data array size, the items are added to the array. */ void QScatterDataProxy::insertItems(int index, const QScatterDataArray &items) { dptr()->insertItems(index, items); emit itemsInserted(index, items.size()); emit itemCountChanged(itemCount()); }
/*! * Inserts the item \a item to the position \a index. If the index is equal to * the data array size, the item is added to the array. */ void QScatterDataProxy::insertItem(int index, const QScatterDataItem &item) { dptr()->insertItem(index, item); emit itemsInserted(index, 1); emit itemCountChanged(itemCount()); }