コード例 #1
0
QString ViewItemSI::doCommand(QString x) {

  QString v=doNamedObjectCommand(x, dim->item);

  if (v.isEmpty()) {
    v=layout->doCommand(x);
  }
  if (v.isEmpty()) {
    v=dim->doCommand(x);
  }
  if (v.isEmpty()) {
    v=fill->doCommand(x);
  }
  if (v.isEmpty()) {
    v=stroke->doCommand(x);
  }
  if (v.isEmpty()&&x.startsWith("setText(")) {
    if(qobject_cast<ButtonItem*>(layout->vi)) {
      qobject_cast<ButtonItem*>(layout->vi)->setText(x.remove("setText(").remove(')'));
      v="Done";
    } else if(qobject_cast<LineEditItem*>(layout->vi)) {
      qobject_cast<LineEditItem*>(layout->vi)->setText(x.remove("setText(").remove(')'));
      v="Done";
    }
  }
  return v.isEmpty()?"No command":v;
}
コード例 #2
0
ファイル: scriptinterface.cpp プロジェクト: KDE/kst-plot
  QString ScriptInterface::doObjectCommand(QString command, ObjectPtr ob) {

    QString v=doNamedObjectCommand(command, ob);
    if (!v.isEmpty()) {
      return v;
    }

    if (command.startsWith("type(")) {
      return ob->typeString();
    }

    return QString();
  }
コード例 #3
0
ファイル: plotscriptinterface.cpp プロジェクト: KDE/kst-plot
QString PlotSI::doCommand(QString x) {
  QString command = x.left(x.indexOf('('));

  InterfaceMemberFn fn=_fnMap.value(command,&PlotSI::noSuchFn);

  if(fn!=&PlotSI::noSuchFn) {
    return CALL_MEMBER_FN(*this,fn)(x);
  }

  QString v=doNamedObjectCommand(x, _dim->item);
  if(v.isEmpty()) {
    v = _layout->doCommand(x);
  }
  if(v.isEmpty()) {
    v=_dim->doCommand(x);
  }
  if(v.isEmpty()) {
    v=_stroke->doCommand(x);
  }
  if(v.isEmpty()) {
    v=_fill->doCommand(x);
  }
  return v.isEmpty()?"No command":v;
}