Ejemplo n.º 1
0
QModelIndex QScriptDebuggerLocalsModelPrivate::addTopLevelObject(const QString &name, const QScriptDebuggerValue &object)
{
    Q_Q(QScriptDebuggerLocalsModel);
    QScriptDebuggerLocalsModelNode *node = invisibleRootNode->findChild(name);
    if (node)
        return indexFromNode(node);
    QScriptDebuggerValueProperty prop(name, object,
                                      QString::fromLatin1(""), // ### string representation of object
                                      /*flags=*/0);
    int rowIndex = invisibleRootNode->children.size();
    q->beginInsertRows(QModelIndex(), rowIndex, rowIndex);
    node = new QScriptDebuggerLocalsModelNode(prop, invisibleRootNode);
    q->endInsertRows();
    return indexFromNode(node);
}
Ejemplo n.º 2
0
void QScriptDebuggerLocalsModelPrivate::repopulate(QScriptDebuggerLocalsModelNode *node)
{
    if (node->populationState != QScriptDebuggerLocalsModelNode::Populated)
        return;
    depopulate(node);
    if (node->property.value().type() == QScriptDebuggerValue::ObjectValue)
        populateIndex(indexFromNode(node));
}
Ejemplo n.º 3
0
void KisNodeModel::progressPercentageChanged(int, const KisNodeSP node)
{
    if(!m_d->dummiesFacade) return;

    // Need to check here as the node might already be removed, but there might
    // still be some signals arriving from another thread
    if (m_d->dummiesFacade->hasDummyForNode(node)) {
        QModelIndex index = indexFromNode(node);
        emit dataChanged(index, index);
    }
}
Ejemplo n.º 4
0
void QScriptDebuggerLocalsModelPrivate::depopulate(QScriptDebuggerLocalsModelNode *node)
{
    Q_Q(QScriptDebuggerLocalsModel);
    bool hasChildren = !node->children.isEmpty();
    if (hasChildren)
        q->beginRemoveRows(indexFromNode(node), 0, node->children.count() - 1);
    QList<qint64> snapshotIds = findSnapshotIdsRecursively(node);
    qDeleteAll(node->children);
    node->children.clear();
    node->snapshotId = -1;
    node->populationState = QScriptDebuggerLocalsModelNode::NotPopulated;
    if (hasChildren)
        q->endRemoveRows();
    deleteObjectSnapshots(snapshotIds);
}
Ejemplo n.º 5
0
void QScriptDebuggerLocalsModelPrivate::reallySyncIndex(const QModelIndex &index,
                                                        const QScriptDebuggerObjectSnapshotDelta &delta)
{
    if (!index.isValid())
        return;
    QScriptDebuggerLocalsModelNode *node = nodeFromIndex(index);
    // update or remove existing children
    for (int i = 0; i < node->children.count(); ++i) {
        QScriptDebuggerLocalsModelNode *child = node->children.at(i);
        int j;
        for (j = 0; j < delta.changedProperties.count(); ++j) {
            if (child->property.name() == delta.changedProperties.at(j).name()) {
                child->property = delta.changedProperties.at(j);
                child->changed = true;
                emitDataChanged(index, index.sibling(0, 1));
                repopulate(child);
                break;
            }
        }
        if (j != delta.changedProperties.count())
            continue; // was changed
        for (j = 0; j < delta.removedProperties.count(); ++j) {
            if (child->property.name() == delta.removedProperties.at(j)) {
                removeChild(index, node, i);
                --i;
                break;
            }
        }
        if (j != delta.removedProperties.count())
            continue; // was removed
        // neither changed nor removed, but its children might be
        if (child->populationState == QScriptDebuggerLocalsModelNode::Populated) {
            QScriptDebuggerJob *job = new SyncModelIndexJob(indexFromNode(child), commandScheduler);
            jobScheduler->scheduleJob(job);
        }
    }
    addChildren(index, node, delta.addedProperties);
}
Ejemplo n.º 6
0
void SiteListItemModel::removeSite(const QString& name, const QUrl& url) {
	SiteListItem* i = mRoot->getChildWith(name, url);
	if(i == NULL) return;
	removeRows(i->parent()->indexOfChild(i), 1, indexFromNode(i->parent()));
}