本文整理汇总了C++中QScriptBreakpointData类的典型用法代码示例。如果您正苦于以下问题:C++ QScriptBreakpointData类的具体用法?C++ QScriptBreakpointData怎么用?C++ QScriptBreakpointData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QScriptBreakpointData类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scriptId
void QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointEnableRequest(int lineNumber, bool enable)
{
QScriptDebuggerCodeViewInterface *view = qobject_cast<QScriptDebuggerCodeViewInterface*>(q_func()->sender());
qint64 sid = scriptId(view);
int bpid = breakpointsModel->resolveBreakpoint(sid, lineNumber);
if (bpid == -1)
bpid = breakpointsModel->resolveBreakpoint(scriptsModel->scriptData(sid).fileName(), lineNumber);
Q_ASSERT(bpid != -1);
QScriptBreakpointData data = breakpointsModel->breakpointData(bpid);
data.setEnabled(enable);
breakpointsModel->setBreakpointData(bpid, data);
}
示例2: _q_onBreakpointsDataChanged
void QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointsDataChanged(
const QModelIndex &tl, const QModelIndex &br)
{
for (int i = tl.row(); i <= br.row(); ++i) {
QScriptBreakpointData data = breakpointsModel->breakpointDataAt(i);
qint64 scriptId = data.scriptId();
if (scriptId == -1) {
scriptId = scriptsModel->resolveScript(data.fileName());
if (scriptId == -1)
continue;
}
QScriptDebuggerCodeViewInterface *view = viewHash.value(scriptId);
if (!view)
continue;
view->setBreakpointEnabled(data.lineNumber(), data.isEnabled());
}
}
示例3: _q_onBreakpointsInserted
void QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointsInserted(
const QModelIndex &, int first, int last)
{
for (int i = first; i <= last; ++i) {
QScriptBreakpointData data = breakpointsModel->breakpointDataAt(i);
qint64 scriptId = data.scriptId();
if (scriptId == -1) {
scriptId = scriptsModel->resolveScript(data.fileName());
if (scriptId == -1)
continue;
}
QScriptDebuggerCodeViewInterface *view = viewHash.value(scriptId);
if (!view)
continue;
view->setBreakpoint(data.lineNumber());
}
}
示例4: Q_D
/*!
\reimp
*/
bool QScriptBreakpointsModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
Q_D(QScriptBreakpointsModel);
if (!index.isValid() || (index.row() >= d->breakpoints.size()))
return false;
const QPair<int, QScriptBreakpointData> &item = d->breakpoints.at(index.row());
QScriptBreakpointData modifiedData;
int col = index.column();
if ((col == 0) || (col == 4)) {
if (role == Qt::CheckStateRole) {
modifiedData = item.second;
if (col == 0)
modifiedData.setEnabled(value.toInt() == Qt::Checked);
else
modifiedData.setSingleShot(value.toInt() == Qt::Checked);
}
} else if (col == 2) {
if (role == Qt::EditRole) {
modifiedData = item.second;
modifiedData.setCondition(value.toString());
}
} else if (col == 3) {
if (role == Qt::EditRole) {
modifiedData = item.second;
modifiedData.setIgnoreCount(value.toInt());
}
}
if (!modifiedData.isValid())
return false;
QScriptDebuggerJob *job = new SetBreakpointDataJob(item.first, modifiedData, d->commandScheduler);
d->jobScheduler->scheduleJob(job);
return true;
}
示例5: Q_D
/*!
Sets a breakpoint defined by the given \a data.
Returns an integer that uniquely identifies the new breakpoint,
or -1 if setting the breakpoint failed.
*/
int QScriptDebuggerAgent::setBreakpoint(const QScriptBreakpointData &data)
{
Q_D(QScriptDebuggerAgent);
qint64 scriptId = data.scriptId();
if (scriptId != -1) {
if (!d->scripts.contains(scriptId)) {
// that script has been unloaded, so invalidate the ID
scriptId = -1;
const_cast<QScriptBreakpointData&>(data).setScriptId(-1);
} else if (data.fileName().isEmpty()) {
QString fileName = d->scripts[scriptId].fileName();
const_cast<QScriptBreakpointData&>(data).setFileName(fileName);
}
}
int id = d->nextBreakpointId;
++d->nextBreakpointId;
if (scriptId != -1) {
d->resolvedBreakpoints[scriptId].append(id);
} else {
QString fileName = data.fileName();
bool resolved = false;
QScriptScriptMap::const_iterator it;
for (it = d->scripts.constBegin(); it != d->scripts.constEnd(); ++it) {
if (it.value().fileName() == fileName) {
d->resolvedBreakpoints[it.key()].append(id);
resolved = true;
break;
}
}
if (!resolved)
d->unresolvedBreakpoints[fileName].append(id);
}
d->breakpoints.insert(id, data);
return id;
}
示例6: breakpointDataToScriptValue
static QScriptValue breakpointDataToScriptValue(QScriptEngine *eng, const QScriptBreakpointData &in)
{
QScriptValue out = eng->newObject();
out.setProperty(QString::fromLatin1("scriptId"), QScriptValue(eng, qsreal(in.scriptId())));
out.setProperty(QString::fromLatin1("fileName"), QScriptValue(eng, in.fileName()));
out.setProperty(QString::fromLatin1("lineNumber"), QScriptValue(eng, in.lineNumber()));
out.setProperty(QString::fromLatin1("enabled"), QScriptValue(eng, in.isEnabled()));
out.setProperty(QString::fromLatin1("singleShot"), QScriptValue(eng, in.isSingleShot()));
out.setProperty(QString::fromLatin1("ignoreCount"), QScriptValue(eng, in.ignoreCount()));
out.setProperty(QString::fromLatin1("condition"), QScriptValue(eng, in.condition()));
return out;
}
示例7: breakpointDataFromScriptValue
static void breakpointDataFromScriptValue(const QScriptValue &in, QScriptBreakpointData &out)
{
QScriptValue scriptId = in.property(QString::fromLatin1("scriptId"));
if (scriptId.isValid())
out.setScriptId((qint64)scriptId.toNumber());
out.setFileName(in.property(QString::fromLatin1("fileName")).toString());
out.setLineNumber(in.property(QString::fromLatin1("lineNumber")).toInt32());
QScriptValue enabled = in.property(QString::fromLatin1("enabled"));
if (enabled.isValid())
out.setEnabled(enabled.toBoolean());
QScriptValue singleShot = in.property(QString::fromLatin1("singleShot"));
if (singleShot.isValid())
out.setSingleShot(singleShot.toBoolean());
out.setIgnoreCount(in.property(QString::fromLatin1("ignoreCount")).toInt32());
out.setCondition(in.property(QString::fromLatin1("condition")).toString());
}
示例8: Q_D
/*!
Returns true if this QScriptBreakpointData is equal to the \a other
data, otherwise returns false.
*/
bool QScriptBreakpointData::operator==(const QScriptBreakpointData &other) const
{
Q_D(const QScriptBreakpointData);
const QScriptBreakpointDataPrivate *od = other.d_func();
if (d == od)
return true;
if (!d || !od)
return false;
return ((d->scriptId == od->scriptId)
&& (d->fileName == od->fileName)
&& (d->lineNumber == od->lineNumber)
&& (d->enabled == od->enabled)
&& (d->singleShot == od->singleShot)
&& (d->condition == od->condition)
&& (d->ignoreCount == od->ignoreCount)
&& (d->data == od->data)
&& (d->hitCount == od->hitCount));
}
示例9: switch
/*!
Applies the given \a command to the given \a backend.
*/
QScriptDebuggerResponse QScriptDebuggerCommandExecutor::execute(
QScriptDebuggerBackend *backend,
const QScriptDebuggerCommand &command)
{
QScriptDebuggerResponse response;
switch (command.type()) {
case QScriptDebuggerCommand::None:
break;
case QScriptDebuggerCommand::Interrupt:
backend->interruptEvaluation();
break;
case QScriptDebuggerCommand::Continue:
if (backend->engine()->isEvaluating()) {
backend->continueEvalution();
response.setAsync(true);
}
break;
case QScriptDebuggerCommand::StepInto: {
QVariant attr = command.attribute(QScriptDebuggerCommand::StepCount);
int count = attr.isValid() ? attr.toInt() : 1;
backend->stepInto(count);
response.setAsync(true);
} break;
case QScriptDebuggerCommand::StepOver: {
QVariant attr = command.attribute(QScriptDebuggerCommand::StepCount);
int count = attr.isValid() ? attr.toInt() : 1;
backend->stepOver(count);
response.setAsync(true);
} break;
case QScriptDebuggerCommand::StepOut:
backend->stepOut();
response.setAsync(true);
break;
case QScriptDebuggerCommand::RunToLocation:
backend->runToLocation(command.fileName(), command.lineNumber());
response.setAsync(true);
break;
case QScriptDebuggerCommand::RunToLocationByID:
backend->runToLocation(command.scriptId(), command.lineNumber());
response.setAsync(true);
break;
case QScriptDebuggerCommand::ForceReturn: {
int contextIndex = command.contextIndex();
QScriptDebuggerValue value = command.scriptValue();
QScriptEngine *engine = backend->engine();
QScriptValue realValue = value.toScriptValue(engine);
backend->returnToCaller(contextIndex, realValue);
response.setAsync(true);
} break;
case QScriptDebuggerCommand::Resume:
backend->resume();
response.setAsync(true);
break;
case QScriptDebuggerCommand::SetBreakpoint: {
QScriptBreakpointData data = command.breakpointData();
if (!data.isValid())
data = QScriptBreakpointData(command.fileName(), command.lineNumber());
int id = backend->setBreakpoint(data);
response.setResult(id);
} break;
case QScriptDebuggerCommand::DeleteBreakpoint: {
int id = command.breakpointId();
if (!backend->deleteBreakpoint(id))
response.setError(QScriptDebuggerResponse::InvalidBreakpointID);
} break;
case QScriptDebuggerCommand::DeleteAllBreakpoints:
backend->deleteAllBreakpoints();
break;
case QScriptDebuggerCommand::GetBreakpoints: {
QScriptBreakpointMap bps = backend->breakpoints();
if (!bps.isEmpty())
response.setResult(bps);
} break;
case QScriptDebuggerCommand::GetBreakpointData: {
int id = command.breakpointId();
QScriptBreakpointData data = backend->breakpointData(id);
if (data.isValid())
response.setResult(data);
else
response.setError(QScriptDebuggerResponse::InvalidBreakpointID);
} break;
case QScriptDebuggerCommand::SetBreakpointData: {
//.........这里部分代码省略.........