本文整理汇总了C++中QScriptBreakpointData::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptBreakpointData::isValid方法的具体用法?C++ QScriptBreakpointData::isValid怎么用?C++ QScriptBreakpointData::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptBreakpointData
的用法示例。
在下文中一共展示了QScriptBreakpointData::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setData
/*!
\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;
}
示例2: execute
/*!
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: {
//.........这里部分代码省略.........