Qt 4.8
Public Functions | List of all members
QScriptBreakpointsModel Class Reference

#include <qscriptbreakpointsmodel_p.h>

Inheritance diagram for QScriptBreakpointsModel:
QAbstractItemModel QObject

Public Functions

void addBreakpoint (int id, const QScriptBreakpointData &data)
 Adds a breakpoint to the model. More...
 
QScriptBreakpointData breakpointData (int id) const
 
QScriptBreakpointData breakpointDataAt (int row) const
 Returns the data for the breakpoint at the given row. More...
 
int breakpointIdAt (int row) const
 Returns the id of the breakpoint at the given row. More...
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Reimplemented Function More...
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Reimplemented Function More...
 
void deleteBreakpoint (int id)
 Deletes the breakpoint with the given id. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const
 Reimplemented Function More...
 
QVariant headerData (int section, Qt::Orientation, int role=Qt::DisplayRole) const
 Reimplemented Function More...
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Reimplemented Function More...
 
void modifyBreakpoint (int id, const QScriptBreakpointData &data)
 Modify the data of breakpoint id. More...
 
QModelIndex parent (const QModelIndex &child) const
 Reimplemented Function More...
 
 QScriptBreakpointsModel (QScriptDebuggerJobSchedulerInterface *jobScheduler, QScriptDebuggerCommandSchedulerInterface *commandScheduler, QObject *parent=0)
 
void removeBreakpoint (int id)
 Remove the breakpoint identified by id from the model. More...
 
int resolveBreakpoint (qint64 scriptId, int lineNumber) const
 Tries to find a breakpoint with the given scriptId and lineNumber. More...
 
int resolveBreakpoint (const QString &fileName, int lineNumber) const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Reimplemented Function More...
 
void setBreakpoint (const QScriptBreakpointData &data)
 Sets a breakpoint defined by the given data. More...
 
void setBreakpointData (int id, const QScriptBreakpointData &data)
 Sets the data associated with the breakpoint identified by id. More...
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 Reimplemented Function More...
 
 ~QScriptBreakpointsModel ()
 
- Public Functions inherited from QAbstractItemModel
virtual QModelIndex buddy (const QModelIndex &index) const
 Returns a model index for the buddy of the item represented by index. More...
 
virtual bool canFetchMore (const QModelIndex &parent) const
 Returns true if there is more data available for parent; otherwise returns false. More...
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 Handles the data supplied by a drag and drop operation that ended with the given action. More...
 
virtual void fetchMore (const QModelIndex &parent)
 Fetches any available data for the items with the parent specified by the parent index. More...
 
virtual bool hasChildren (const QModelIndex &parent=QModelIndex()) const
 Returns true if parent has any children; otherwise returns false. More...
 
bool hasIndex (int row, int column, const QModelIndex &parent=QModelIndex()) const
 Returns true if the model returns a valid QModelIndex for row and column with parent, otherwise returns false. More...
 
bool insertColumn (int column, const QModelIndex &parent=QModelIndex())
 Inserts a single column before the given column in the child items of the parent specified. More...
 
virtual bool insertColumns (int column, int count, const QModelIndex &parent=QModelIndex())
 On models that support this, inserts count new columns into the model before the given column. More...
 
bool insertRow (int row, const QModelIndex &parent=QModelIndex())
 Inserts a single row before the given row in the child items of the parent specified. More...
 
virtual bool insertRows (int row, int count, const QModelIndex &parent=QModelIndex())
 On models that support this, inserts count rows into the model before the given row. More...
 
virtual QMap< int, QVariantitemData (const QModelIndex &index) const
 Returns a map with values for all predefined roles in the model for the item at the given index. More...
 
virtual QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
 Returns a list of indexes for the items in the column of the start index where data stored under the given role matches the specified value. More...
 
virtual QMimeDatamimeData (const QModelIndexList &indexes) const
 Returns an object that contains serialized items of data corresponding to the list of indexes specified. More...
 
virtual QStringList mimeTypes () const
 Returns a list of MIME types that can be used to describe a list of model indexes. More...
 
 QAbstractItemModel (QObject *parent=0)
 Constructs an abstract item model with the given parent. More...
 
bool removeColumn (int column, const QModelIndex &parent=QModelIndex())
 Removes the given column from the child items of the parent specified. More...
 
virtual bool removeColumns (int column, int count, const QModelIndex &parent=QModelIndex())
 On models that support this, removes count columns starting with the given column under parent parent from the model. More...
 
bool removeRow (int row, const QModelIndex &parent=QModelIndex())
 Removes the given row from the child items of the parent specified. More...
 
virtual bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex())
 On models that support this, removes count rows starting with the given row under parent parent from the model. More...
 
const QHash< int, QByteArray > & roleNames () const
 Returns the model's role names. More...
 
virtual bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole)
 Sets the data for the given role and section in the header with the specified orientation to the value supplied. More...
 
virtual bool setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
 Sets the role data for the item at index to the associated value in roles, for every Qt::ItemDataRole. More...
 
void setSupportedDragActions (Qt::DropActions)
 Sets the supported drag actions for the items in the model. More...
 
QModelIndex sibling (int row, int column, const QModelIndex &idx) const
 Returns the sibling at row and column for the item at index, or an invalid QModelIndex if there is no sibling at that location. More...
 
virtual void sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
 Sorts the model by column in the given order. More...
 
virtual QSize span (const QModelIndex &index) const
 Returns the row and column span of the item represented by index. More...
 
Qt::DropActions supportedDragActions () const
 Returns the actions supported by the data in this model. More...
 
virtual Qt::DropActions supportedDropActions () const
 Returns the drop actions supported by this model. More...
 
virtual ~QAbstractItemModel ()
 Destroys the abstract item model. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Additional Inherited Members

- Public Slots inherited from QAbstractItemModel
virtual void revert ()
 Lets the model know that it should discard cached information. More...
 
virtual bool submit ()
 Lets the model know that it should submit cached information to permanent storage. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QAbstractItemModel
void columnsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 This signal is emitted just before columns are inserted into the model. More...
 
void columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 This signal is emitted just before columns are moved within the model. More...
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 This signal is emitted just before columns are removed from the model. More...
 
void columnsInserted (const QModelIndex &parent, int first, int last)
 This signal is emitted after columns have been inserted into the model. More...
 
void columnsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
 This signal is emitted after columns have been moved within the model. More...
 
void columnsRemoved (const QModelIndex &parent, int first, int last)
 This signal is emitted after columns have been removed from the model. More...
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
 This signal is emitted whenever the data in an existing item changes. More...
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 This signal is emitted whenever a header is changed. More...
 
void layoutAboutToBeChanged ()
 This signal is emitted just before the layout of a model is changed. More...
 
void layoutChanged ()
 This signal is emitted whenever the layout of items exposed by the model has changed; for example, when the model has been sorted. More...
 
void modelAboutToBeReset ()
 This signal is emitted when reset() is called, before the model's internal state (e. More...
 
void modelReset ()
 This signal is emitted when reset() is called, after the model's internal state (e. More...
 
void rowsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 This signal is emitted just before rows are inserted into the model. More...
 
void rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 This signal is emitted just before rows are moved within the model. More...
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 This signal is emitted just before rows are removed from the model. More...
 
void rowsInserted (const QModelIndex &parent, int first, int last)
 This signal is emitted after rows have been inserted into the model. More...
 
void rowsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
 This signal is emitted after rows have been moved within the model. More...
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 This signal is emitted after rows have been removed from the model. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Slots inherited from QAbstractItemModel
void resetInternalData ()
 This slot is called just after the internal data of a model is cleared while it is being reset. More...
 
- Protected Functions inherited from QAbstractItemModel
void beginInsertColumns (const QModelIndex &parent, int first, int last)
 Begins a column insertion operation. More...
 
void beginInsertRows (const QModelIndex &parent, int first, int last)
 Begins a row insertion operation. More...
 
bool beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn)
 Begins a column move operation. More...
 
bool beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow)
 Begins a row move operation. More...
 
void beginRemoveColumns (const QModelIndex &parent, int first, int last)
 Begins a column removal operation. More...
 
void beginRemoveRows (const QModelIndex &parent, int first, int last)
 Begins a row removal operation. More...
 
void beginResetModel ()
 Begins a model reset operation. More...
 
void changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 Changes the QPersistentModelIndex that is equal to the given from model index to the given to model index. More...
 
void changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 Changes the QPersistentModelIndexes that is equal to the indexes in the given from model index list to the given to model index list. More...
 
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. More...
 
QModelIndex createIndex (int row, int column, int id) const
 Use QModelIndex QAbstractItemModel::createIndex(int row, int column, quint32 id) instead. More...
 
QModelIndex createIndex (int row, int column, quint32 id) const
 Creates a model index for the given row and column with the internal identifier, id. More...
 
bool decodeData (int row, int column, const QModelIndex &parent, QDataStream &stream)
 
void encodeData (const QModelIndexList &indexes, QDataStream &stream) const
 
void endInsertColumns ()
 Ends a column insertion operation. More...
 
void endInsertRows ()
 Ends a row insertion operation. More...
 
void endMoveColumns ()
 Ends a column move operation. More...
 
void endMoveRows ()
 Ends a row move operation. More...
 
void endRemoveColumns ()
 Ends a column removal operation. More...
 
void endRemoveRows ()
 Ends a row removal operation. More...
 
void endResetModel ()
 Completes a model reset operation. More...
 
QModelIndexList persistentIndexList () const
 Returns the list of indexes stored as persistent indexes in the model. More...
 
 QAbstractItemModel (QAbstractItemModelPrivate &dd, QObject *parent=0)
 
void reset ()
 Resets the model to its original state in any attached views. More...
 
void setRoleNames (const QHash< int, QByteArray > &roleNames)
 Sets the model's role names to roleNames. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Since
4.5
Warning
This function is not part of the public interface.

Definition at line 66 of file qscriptbreakpointsmodel_p.h.

Constructors and Destructors

◆ QScriptBreakpointsModel()

QScriptBreakpointsModel::QScriptBreakpointsModel ( QScriptDebuggerJobSchedulerInterface jobScheduler,
QScriptDebuggerCommandSchedulerInterface commandScheduler,
QObject parent = 0 
)

Definition at line 83 of file qscriptbreakpointsmodel.cpp.

88 {
90  d->jobScheduler = jobScheduler;
91  d->commandScheduler = commandScheduler;
92 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QAbstractItemModel(QObject *parent=0)
Constructs an abstract item model with the given parent.

◆ ~QScriptBreakpointsModel()

QScriptBreakpointsModel::~QScriptBreakpointsModel ( )

Definition at line 94 of file qscriptbreakpointsmodel.cpp.

95 {
96 }

Functions

◆ addBreakpoint()

void QScriptBreakpointsModel::addBreakpoint ( int  id,
const QScriptBreakpointData data 
)

Adds a breakpoint to the model.

This function does not actually set a breakpoint (i.e. it doesn't communicate with the debugger).

Definition at line 225 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerPrivate::handleResponse().

226 {
228  int rowIndex = d->breakpoints.size();
229  beginInsertRows(QModelIndex(), rowIndex, rowIndex);
230  d->breakpoints.append(qMakePair(id, data));
231  endInsertRows();
232 }
double d
Definition: qnumeric_p.h:62
void endInsertRows()
Ends a row insertion operation.
#define Q_D(Class)
Definition: qglobal.h:2482
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
The QModelIndex class is used to locate data in a data model.
void beginInsertRows(const QModelIndex &parent, int first, int last)
Begins a row insertion operation.

◆ breakpointData()

QScriptBreakpointData QScriptBreakpointsModel::breakpointData ( int  id) const

Definition at line 285 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointEnableRequest(), and QScriptDebuggerPrivate::debuggerEvent().

286 {
288  for (int i = 0; i < d->breakpoints.size(); ++i) {
289  if (d->breakpoints.at(i).first == id)
290  return d->breakpoints.at(i).second;
291  }
292  return QScriptBreakpointData();
293 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptBreakpointData class contains data associated with a breakpoint.

◆ breakpointDataAt()

QScriptBreakpointData QScriptBreakpointsModel::breakpointDataAt ( int  row) const

Returns the data for the breakpoint at the given row.

Definition at line 279 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointsAboutToBeRemoved(), QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointsDataChanged(), and QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointsInserted().

280 {
282  return d->breakpoints.at(row).second;
283 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ breakpointIdAt()

int QScriptBreakpointsModel::breakpointIdAt ( int  row) const

Returns the id of the breakpoint at the given row.

Definition at line 270 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptBreakpointsWidget::keyPressEvent().

271 {
273  return d->breakpoints.at(row).first;
274 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ columnCount()

int QScriptBreakpointsModel::columnCount ( const QModelIndex parent = QModelIndex()) const
virtual

Reimplemented Function

Implements QAbstractItemModel.

Definition at line 350 of file qscriptbreakpointsmodel.cpp.

Referenced by index(), and modifyBreakpoint().

351 {
352  if (!parent.isValid())
353  return 6;
354  return 0;
355 }
bool isValid() const
Returns true if this model index is valid; otherwise returns false.

◆ data()

QVariant QScriptBreakpointsModel::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const
virtual

Reimplemented Function

Implements QAbstractItemModel.

Definition at line 371 of file qscriptbreakpointsmodel.cpp.

Referenced by setBreakpoint(), and ~QScriptBreakpointsModel().

372 {
374  if (!index.isValid() || (index.row() >= d->breakpoints.size()))
375  return QVariant();
376  const QPair<int, QScriptBreakpointData> &item = d->breakpoints.at(index.row());
377  if (role == Qt::DisplayRole) {
378  if (index.column() == 0)
379  return item.first;
380  else if (index.column() == 1) {
381  QString loc = item.second.fileName();
382  if (loc.isEmpty())
383  loc = QString::fromLatin1("<anonymous script, id=%0>").arg(item.second.scriptId());
384  loc.append(QString::fromLatin1(":%0").arg(item.second.lineNumber()));
385  return loc;
386  } else if (index.column() == 2) {
387  if (!item.second.condition().isEmpty())
388  return item.second.condition();
389  } else if (index.column() == 3) {
390  if (item.second.ignoreCount() != 0)
391  return item.second.ignoreCount();
392  } else if (index.column() == 5) {
393  return item.second.hitCount();
394  }
395  } else if (role == Qt::CheckStateRole) {
396  if (index.column() == 0) {
397  return item.second.isEnabled() ? Qt::Checked : Qt::Unchecked;
398  } else if (index.column() == 4) {
399  return item.second.isSingleShot() ? Qt::Checked : Qt::Unchecked;
400  }
401  } else if (role == Qt::EditRole) {
402  if (index.column() == 2)
403  return item.second.condition();
404  else if (index.column() == 3)
405  return item.second.ignoreCount();
406  }
407  return QVariant();
408 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
bool isSingleShot() const
Returns true if the breakpoint is single-shot, false otherwise.
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
int ignoreCount() const
Returns the ignore count of the breakpoint.
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_D(Class)
Definition: qglobal.h:2482
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
int row() const
Returns the row this model index refers to.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
QString & append(QChar c)
Definition: qstring.cpp:1777
bool isEnabled() const
Returns true if the breakpoint is enabled, false otherwise.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
if(void) toggleToolbarShown
QString condition() const
Returns the condition of the breakpoint.
int hitCount() const
Returns the hit count of the breakpoint (the number of times the breakpoint has been triggered)...
int lineNumber() const
Returns the breakpoint line number.
int column() const
Returns the column this model index refers to.

◆ deleteBreakpoint()

void QScriptBreakpointsModel::deleteBreakpoint ( int  id)

Deletes the breakpoint with the given id.

The corresponding row in the model will be removed if the breakpoint was successfully deleted.

Definition at line 214 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointToggleRequest(), QScriptDebuggerPrivate::_q_toggleBreakpoint(), and QScriptBreakpointsWidget::keyPressEvent().

215 {
217  QScriptDebuggerJob *job = new DeleteBreakpointJob(id, d->commandScheduler);
218  d->jobScheduler->scheduleJob(job);
219 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ flags()

Qt::ItemFlags QScriptBreakpointsModel::flags ( const QModelIndex index) const
virtual

Reimplemented Function

Reimplemented from QAbstractItemModel.

Definition at line 474 of file qscriptbreakpointsmodel.cpp.

475 {
476  if (!index.isValid())
477  return 0;
478  Qt::ItemFlags ret = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
479  switch (index.column()) {
480  case 0:
482  break;
483  case 1:
484  break;
485  case 2:
486  ret |= Qt::ItemIsEditable;
487  break;
488  case 3:
489  ret |= Qt::ItemIsEditable;
490  break;
491  case 4:
493  break;
494  }
495  return ret;
496 }
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
int column() const
Returns the column this model index refers to.

◆ headerData()

QVariant QScriptBreakpointsModel::headerData ( int  section,
Qt::Orientation  orient,
int  role = Qt::DisplayRole 
) const
virtual

Reimplemented Function

Reimplemented from QAbstractItemModel.

Definition at line 450 of file qscriptbreakpointsmodel.cpp.

451 {
452  if (orient == Qt::Horizontal) {
453  if (role == Qt::DisplayRole) {
454  if (section == 0)
455  return QCoreApplication::translate("QScriptBreakpointsModel", "ID");
456  else if (section == 1)
457  return QCoreApplication::translate("QScriptBreakpointsModel", "Location");
458  else if (section == 2)
459  return QCoreApplication::translate("QScriptBreakpointsModel", "Condition");
460  else if (section == 3)
461  return QCoreApplication::translate("QScriptBreakpointsModel", "Ignore-count");
462  else if (section == 4)
463  return QCoreApplication::translate("QScriptBreakpointsModel", "Single-shot");
464  else if (section == 5)
465  return QCoreApplication::translate("QScriptBreakpointsModel", "Hit-count");
466  }
467  }
468  return QVariant();
469 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
static QString translate(const char *context, const char *key, const char *disambiguation=0, Encoding encoding=CodecForTr)

◆ index()

QModelIndex QScriptBreakpointsModel::index ( int  row,
int  column,
const QModelIndex parent = QModelIndex() 
) const
virtual

Reimplemented Function

Implements QAbstractItemModel.

Definition at line 327 of file qscriptbreakpointsmodel.cpp.

328 {
330  if (parent.isValid())
331  return QModelIndex();
332  if ((row < 0) || (row >= d->breakpoints.size()))
333  return QModelIndex();
334  if ((column < 0) || (column >= columnCount()))
335  return QModelIndex();
336  return createIndex(row, column);
337 }
double d
Definition: qnumeric_p.h:62
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. ...
#define Q_D(Class)
Definition: qglobal.h:2482
int columnCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
The QModelIndex class is used to locate data in a data model.

◆ modifyBreakpoint()

void QScriptBreakpointsModel::modifyBreakpoint ( int  id,
const QScriptBreakpointData data 
)

Modify the data of breakpoint id.

Definition at line 237 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerPrivate::handleResponse().

238 {
240  for (int i = 0; i < d->breakpoints.size(); ++i) {
241  if (d->breakpoints.at(i).first == id) {
242  d->breakpoints[i] = qMakePair(id, data);
244  break;
245  }
246  }
247 }
double d
Definition: qnumeric_p.h:62
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. ...
#define Q_D(Class)
Definition: qglobal.h:2482
#define emit
Definition: qobjectdefs.h:76
int columnCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented Function
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
This signal is emitted whenever the data in an existing item changes.

◆ parent()

QModelIndex QScriptBreakpointsModel::parent ( const QModelIndex child) const
virtual

Reimplemented Function

Implements QAbstractItemModel.

Definition at line 342 of file qscriptbreakpointsmodel.cpp.

343 {
344  return QModelIndex();
345 }
The QModelIndex class is used to locate data in a data model.

◆ removeBreakpoint()

void QScriptBreakpointsModel::removeBreakpoint ( int  id)

Remove the breakpoint identified by id from the model.

This function does not delete the breakpoint (i.e. it doesn't communicate with the debugger).

Definition at line 254 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerPrivate::debuggerEvent(), and QScriptDebuggerPrivate::handleResponse().

255 {
257  for (int i = 0; i < d->breakpoints.size(); ++i) {
258  if (d->breakpoints.at(i).first == id) {
259  beginRemoveRows(QModelIndex(), i, i);
260  d->breakpoints.removeAt(i);
261  endRemoveRows();
262  break;
263  }
264  }
265 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
void endRemoveRows()
Ends a row removal operation.
void beginRemoveRows(const QModelIndex &parent, int first, int last)
Begins a row removal operation.
The QModelIndex class is used to locate data in a data model.

◆ resolveBreakpoint() [1/2]

int QScriptBreakpointsModel::resolveBreakpoint ( qint64  scriptId,
int  lineNumber 
) const

Tries to find a breakpoint with the given scriptId and lineNumber.

Returns the id of the first breakpoint that matches, or -1 if no such breakpoint is found.

Definition at line 300 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointEnableRequest(), QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointToggleRequest(), and QScriptDebuggerPrivate::_q_toggleBreakpoint().

301 {
303  for (int i = 0; i < d->breakpoints.size(); ++i) {
304  if ((d->breakpoints.at(i).second.scriptId() == scriptId)
305  && (d->breakpoints.at(i).second.lineNumber() == lineNumber)) {
306  return d->breakpoints.at(i).first;
307  }
308  }
309  return -1;
310 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ resolveBreakpoint() [2/2]

int QScriptBreakpointsModel::resolveBreakpoint ( const QString fileName,
int  lineNumber 
) const

Definition at line 312 of file qscriptbreakpointsmodel.cpp.

313 {
315  for (int i = 0; i < d->breakpoints.size(); ++i) {
316  if ((d->breakpoints.at(i).second.fileName() == fileName)
317  && (d->breakpoints.at(i).second.lineNumber() == lineNumber)) {
318  return d->breakpoints.at(i).first;
319  }
320  }
321  return -1;
322 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
static QString fileName(const QString &fileUrl)

◆ rowCount()

int QScriptBreakpointsModel::rowCount ( const QModelIndex parent = QModelIndex()) const
virtual

Reimplemented Function

Implements QAbstractItemModel.

Definition at line 360 of file qscriptbreakpointsmodel.cpp.

361 {
363  if (!parent.isValid())
364  return d->breakpoints.size();
365  return 0;
366 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
bool isValid() const
Returns true if this model index is valid; otherwise returns false.

◆ setBreakpoint()

void QScriptBreakpointsModel::setBreakpoint ( const QScriptBreakpointData data)

Sets a breakpoint defined by the given data.

A new row will be inserted into the model if the breakpoint could be successfully set.

Definition at line 132 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointToggleRequest(), and QScriptDebuggerPrivate::_q_toggleBreakpoint().

133 {
135  QScriptDebuggerJob *job = new SetBreakpointJob(data, d->commandScheduler);
136  d->jobScheduler->scheduleJob(job);
137 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setBreakpointData()

void QScriptBreakpointsModel::setBreakpointData ( int  id,
const QScriptBreakpointData data 
)

Sets the data associated with the breakpoint identified by id.

A dataChanged() signal will be emitted if the breakpoint data could be successfully changed.

Definition at line 174 of file qscriptbreakpointsmodel.cpp.

Referenced by QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointEnableRequest().

175 {
177  QScriptDebuggerJob *job = new SetBreakpointDataJob(id, data, d->commandScheduler);
178  d->jobScheduler->scheduleJob(job);
179 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ setData()

bool QScriptBreakpointsModel::setData ( const QModelIndex index,
const QVariant value,
int  role = Qt::EditRole 
)
virtual

Reimplemented Function

Reimplemented from QAbstractItemModel.

Definition at line 413 of file qscriptbreakpointsmodel.cpp.

414 {
416  if (!index.isValid() || (index.row() >= d->breakpoints.size()))
417  return false;
418  const QPair<int, QScriptBreakpointData> &item = d->breakpoints.at(index.row());
419  QScriptBreakpointData modifiedData;
420  int col = index.column();
421  if ((col == 0) || (col == 4)) {
422  if (role == Qt::CheckStateRole) {
423  modifiedData = item.second;
424  if (col == 0)
425  modifiedData.setEnabled(value.toInt() == Qt::Checked);
426  else
427  modifiedData.setSingleShot(value.toInt() == Qt::Checked);
428  }
429  } else if (col == 2) {
430  if (role == Qt::EditRole) {
431  modifiedData = item.second;
432  modifiedData.setCondition(value.toString());
433  }
434  } else if (col == 3) {
435  if (role == Qt::EditRole) {
436  modifiedData = item.second;
437  modifiedData.setIgnoreCount(value.toInt());
438  }
439  }
440  if (!modifiedData.isValid())
441  return false;
442  QScriptDebuggerJob *job = new SetBreakpointDataJob(item.first, modifiedData, d->commandScheduler);
443  d->jobScheduler->scheduleJob(job);
444  return true;
445 }
double d
Definition: qnumeric_p.h:62
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
#define Q_D(Class)
Definition: qglobal.h:2482
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
Definition: qvariant.cpp:2625
void setSingleShot(bool singleShot)
Sets the singleShot state of the breakpoint.
int row() const
Returns the row this model index refers to.
void setIgnoreCount(int count)
Sets the ignore count of the breakpoint.
void setEnabled(bool enabled)
Sets the enabled state of the breakpoint.
void setCondition(const QString &condition)
Sets the condition of the breakpoint.
The QScriptBreakpointData class contains data associated with a breakpoint.
bool isValid() const
Returns true if this model index is valid; otherwise returns false.
int column() const
Returns the column this model index refers to.

The documentation for this class was generated from the following files: