53 #include "private/qabstractitemmodel_p.h" 55 #include <QtCore/qdebug.h> 56 #include <QtCore/qcoreapplication.h> 57 #include <QtCore/qpointer.h> 58 #include <QtGui/qbrush.h> 59 #include <QtGui/qfont.h> 127 void syncTopLevelNodes();
128 void removeTopLevelNodes();
129 void emitScopeObjectAvailable(
const QModelIndex &index);
140 void deleteObjectSnapshots(
const QList<qint64> &snapshotIds);
141 void deleteAllObjectSnapshots();
157 delete invisibleRootNode;
162 q_func()->dataChanged(tl, br);
191 q->beginRemoveRows(parentIndex, row, row);
196 deleteObjectSnapshots(snapshotIds);
204 q->beginRemoveRows(indexFromNode(node), 0, node->
children.
count() - 1);
212 deleteObjectSnapshots(snapshotIds);
221 populateIndex(indexFromNode(node));
232 int last = first + props.
size() - 1;
233 q->beginInsertRows(parentIndex, first, last);
234 for (
int i = 0; i < props.
size(); ++i)
242 for (
int i = 0; i < snapshotIds.
size(); ++i)
249 for (
int i = 0; i < invisibleRootNode->children.count(); ++i)
251 deleteObjectSnapshots(snapshotIds);
268 m_index(index), m_expression(expression), m_state(0) {}
272 if (!m_index.isValid())
281 if (!m_index.isValid()) {
297 hibernateUntilEvaluateFinished();
308 if (!m_index.isValid()) {
331 return invisibleRootNode;
338 if (!node || (node == invisibleRootNode))
342 return createIndex(row, 0, node);
347 return node && (node->
parent == invisibleRootNode);
358 m_index(index), m_state(0)
363 if (!m_index.isValid())
372 if (!m_index.isValid()) {
384 if (!m_index.isValid()) {
404 model()->reallyPopulateIndex(m_index, props);
429 jobScheduler->scheduleJob(job);
441 addChildren(index, node, props);
451 d->jobScheduler = jobScheduler;
452 d->commandScheduler = commandScheduler;
464 return indexFromNode(node);
468 int rowIndex = invisibleRootNode->children.size();
469 q->beginInsertRows(
QModelIndex(), rowIndex, rowIndex);
472 return indexFromNode(node);
484 m_model(model), m_frameIndex(frameIndex), m_state(0)
511 for (
int i = 0; i < scopeChain.
size(); ++i) {
544 d->jobScheduler->scheduleJob(job);
556 m_model(model), m_frameIndex(frameIndex), m_state(0)
582 m_topLevelObjects << scopeChain;
589 m_topLevelObjects.append(thisObject);
591 for (
int i = 0; equal && (i < m_topLevelObjects.size()); ++i) {
600 for (
int j = 0; j < m_topLevelObjects.size(); ++j) {
603 if (j == m_topLevelObjects.size()-1) {
636 d->jobScheduler->scheduleJob(job);
652 if (!m_index.isValid())
661 if (!m_index.isValid()) {
676 model()->reallySyncIndex(m_index, delta);
694 jobScheduler->scheduleJob(job);
711 emitDataChanged(index, index.
sibling(0, 1));
720 removeChild(index, node, i);
729 QScriptDebuggerJob *job =
new SyncModelIndexJob(indexFromNode(child), commandScheduler);
730 jobScheduler->scheduleJob(job);
739 for (
int i = 0; i < invisibleRootNode->children.count(); ++i) {
743 emit q->scopeObjectAvailable(index);
749 while (!invisibleRootNode->children.isEmpty())
755 emit q_func()->scopeObjectAvailable(index);
761 return d->frameIndex;
785 return d->indexFromNode(node->
parent);
820 else if (index.
column() == 1) {
824 int lineCount = lines.
size();
826 lines = lines.
mid(0, 1);
834 if ((index.
column() == 1) && !
d->isTopLevelNode(node)) {
845 if (index.
column() == 1) {
853 if (
d->isTopLevelNode(node))
856 if (
d->isTopLevelNode(node))
859 if (
d->isTopLevelNode(node) || node->
changed) {
885 d->jobScheduler->scheduleJob(job);
898 else if (section == 1)
956 d->populateIndex(parent);
The QVariant class acts like a union for the most common Qt data types.
T qobject_cast(QObject *object)
The QColor class provides colors based on RGB, HSV or CMYK values.
void * internalPointer() const
Returns a void * pointer used by the model to associate the index with the internal data structure...
QScriptDebuggerCommandSchedulerInterface * commandScheduler
Qt::ItemFlags flags(const QModelIndex &index) const
Reimplemented Function
bool isTopLevelNode(QScriptDebuggerLocalsModelNode *node) const
#define QT_END_NAMESPACE
This macro expands to.
~QScriptDebuggerLocalsModelNode()
QScriptDebuggerValueProperty property
QScriptDebuggerValue resultAsScriptValue() const
QModelIndex sibling(int row, int column) const
Returns the sibling at row and column.
QScriptDebuggerLocalsModelNode * nodeFromIndex(const QModelIndex &index) const
void emitDataChanged(const QModelIndex &tl, const QModelIndex &br)
~QScriptDebuggerLocalsModel()
QString & replace(int i, int len, QChar after)
The QScriptDebuggerResponse class represents a front-end's response to a QScriptDebuggerCommand.
QScriptDebuggerLocalsModelNode(const QScriptDebuggerValueProperty &prop, QScriptDebuggerLocalsModelNode *par)
int rowCount(const QModelIndex &parent) const
Reimplemented Function
QString & prepend(QChar c)
QString name() const
Returns the name of this QScriptDebuggerValueProperty.
QScriptDebuggerLocalsModel(QScriptDebuggerJobSchedulerInterface *jobScheduler, QScriptDebuggerCommandSchedulerInterface *commandScheduler, QObject *parent=0)
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
QModelIndex createIndex(int row, int column, void *data=0) const
Creates a model index for the given row and column with the internal pointer ptr. ...
bool hasChildren(const QModelIndex &parent) const
Reimplemented Function
void fetchMore(const QModelIndex &parent)
Reimplemented Function
QScriptDebuggerValue value() const
Returns the value of this QScriptDebuggerValueProperty.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
static QList< qint64 > findSnapshotIdsRecursively(QScriptDebuggerLocalsModelNode *root)
QVariant headerData(int section, Qt::Orientation, int role=Qt::DisplayRole) const
Reimplemented Function
void removeChild(const QModelIndex &parentIndex, QScriptDebuggerLocalsModelNode *parentNode, int row)
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Reimplemented Function
The QObject class is the base class of all Qt objects.
void init(int frameIndex)
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
QString toString(Qt::DateFormat f=Qt::TextDate) const
Returns the datetime as a string in the format given.
The QPointer class is a template class that provides guarded pointers to QObject. ...
void removeTopLevelNodes()
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QScriptValue::PropertyFlags flags() const
Returns the flags of this QScriptDebuggerValueProperty.
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)
QList< T > mid(int pos, int length=-1) const
Returns a list whose elements are copied from this list, starting at position pos.
static QScriptDebuggerLocalsModelPrivate * get(QScriptDebuggerLocalsModel *q)
QString valueAsString() const
void sync(int frameIndex)
QScriptDebuggerJobSchedulerInterface * jobScheduler
int scheduleSetScriptValueProperty(const QScriptDebuggerValue &object, const QString &name, const QScriptDebuggerValue &value)
void append(const T &t)
Inserts value at the end of the list.
void reallyPopulateIndex(const QModelIndex &index, const QScriptDebuggerValuePropertyList &props)
void reallySyncIndex(const QModelIndex &index, const QScriptDebuggerObjectSnapshotDelta &delta)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void deleteObjectSnapshots(const QList< qint64 > &snapshotIds)
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
void populateIndex(const QModelIndex &index)
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
T takeFirst()
Removes the first item in the list and returns it.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool canFetchMore(const QModelIndex &parent) const
Reimplemented Function
void emitScopeObjectAvailable(const QModelIndex &index)
void prepend(const T &t)
Inserts value at the beginning of the list.
QScriptDebuggerLocalsModelNode * invisibleRootNode
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
QScriptDebuggerLocalsModelNode * parent
QScriptDebuggerLocalsModelNode * findChild(const QString &name)
QScriptDebuggerValuePropertyList changedProperties
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QStringList removedProperties
void repopulate(QScriptDebuggerLocalsModelNode *node)
void clear()
Removes all items from the list.
QList< QScriptDebuggerLocalsModelNode * > children
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QAbstractItemModel class provides the abstract interface for item model classes.
QScriptDebuggerLocalsModelNode()
int scheduleScriptObjectSnapshotCapture(int id, const QScriptDebuggerValue &object)
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QString join(const QString &sep) const
Joins all the string list's strings into a single string with each element separated by the given sep...
ValueType type() const
Returns the type of this value.
QModelIndex indexFromNode(QScriptDebuggerLocalsModelNode *node) const
The QScriptDebuggerValue class represents a script value.
QScriptDebuggerValueList resultAsScriptValueList() const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
#define Q_DECLARE_PUBLIC(Class)
QString & append(QChar c)
int scheduleGetThisObject(int contextIndex)
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
QScriptDebuggerLocalsModelPrivate()
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Reimplemented Function
The QPersistentModelIndex class is used to locate data in a data model.
The QFont class specifies a font used for drawing text.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
int scheduleDeleteScriptObjectSnapshot(int id)
QObject * parent() const
Returns a pointer to the parent object.
The QModelIndex class is used to locate data in a data model.
int size() const
Returns the number of items in the list.
void addChildren(const QModelIndex &parentIndex, QScriptDebuggerLocalsModelNode *parentNode, const QScriptDebuggerValuePropertyList &props)
int scheduleGetScopeChain(int contextIndex)
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
PopulationState populationState
T qvariant_cast(const QVariant &)
T takeAt(int i)
Removes the item at index position i and returns it.
void syncIndex(const QModelIndex &index)
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
QModelIndex addTopLevelObject(const QString &name, const QScriptDebuggerValue &object)
int scheduleEvaluate(int contextIndex, const QString &program, const QString &fileName=QString(), int lineNumber=1)
QScriptDebuggerValuePropertyList addedProperties
int columnCount(const QModelIndex &parent) const
Reimplemented Function
int scheduleNewScriptObjectSnapshot()
QVariant result() const
Returns the result of this response.
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
~QScriptDebuggerLocalsModelPrivate()
void depopulate(QScriptDebuggerLocalsModelNode *node)
static bool equal(const QChar *a, int l, const char *b)
int column() const
Returns the column this model index refers to.
The QList class is a template class that provides lists.
void deleteAllObjectSnapshots()