bool KstPlotGroup::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent) {
  KstMetaPlot::popupMenu(menu, pos, topParent);
  KstViewObjectPtr c = findChild(pos + position());
  if (c) {
    KPopupMenu *s = new KPopupMenu(menu);
    if (c->popupMenu(s, pos - c->position(), topParent)) {
      menu->insertItem(c->tagName(), s);
    } else {
      delete s;
    }
  }
  return true;
}
Exemple #2
0
bool KstIfaceImpl::deletePlot(const QString& window, const QString& name) {
  KstViewWindow *pView = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(window));
  if (pView) {
    KstTopLevelViewPtr pTLV = pView->view();
    KstViewObjectList objects = pTLV->findChildrenType<KstViewObject>(true);

    for (KstViewObjectList::Iterator it = objects.begin(); it != objects.end(); ++it) {
      KstViewObjectPtr object = *it;
      if (object->tagName() == name) {
        pTLV->removeChild(object, true);
        _doc->forceUpdate();
        _doc->setModified();
        return true;
      }
    }
  }

  return false;
}