当前位置: 首页>>代码示例>>C++>>正文


C++ Q3PtrDict::replace方法代码示例

本文整理汇总了C++中Q3PtrDict::replace方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3PtrDict::replace方法的具体用法?C++ Q3PtrDict::replace怎么用?C++ Q3PtrDict::replace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q3PtrDict的用法示例。


在下文中一共展示了Q3PtrDict::replace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: get_drawn

static void get_drawn(DiagramItemList & items,
		      Q3PtrDict<DiagramItem> & drawn)
{
  DiagramItem * di;
  
  for (di = items.first(); di != 0; di = items.next()) {
    UmlCode k = di->type();
    
    switch (k) {
    case UmlComponent:
    case UmlPackage:
      drawn.replace(di->get_bn()->get_data(), di);
      break;
    default:
      if (IsaSimpleRelation(k))
	drawn.replace(((ArrowCanvas *) di)->get_data(), di);
    }
  }
}
开发者ID:kralf,项目名称:bouml,代码行数:19,代码来源:ComponentDiagramView.cpp

示例2: drop

// the relation is not yet drawn,
void SimpleRelationCanvas::drop(BrowserNode * bn, UmlCanvas * canvas,
                                Q3PtrDict<DiagramItem> & drawn)
{
    SimpleRelationData * def = (SimpleRelationData *) bn->get_data();
    BrowserNode * from = def->get_start_node();
    BrowserNode * to = def->get_end_node();
    DiagramItem * ccfrom = drawn[from->get_data()];
    DiagramItem * ccto = drawn[to->get_data()];

    if ((ccfrom != 0) && (ccto != 0)) {
        SimpleRelationCanvas * rel =
            new SimpleRelationCanvas(canvas, ccfrom, ccto, from,
                                     bn->get_type(), 0, -1.0, -1.0, def);

        rel->show();
        rel->package_modified();

        drawn.replace(def, rel);

        // package set modified by caller
    }
}
开发者ID:harmegnies,项目名称:douml,代码行数:23,代码来源:SimpleRelationCanvas.cpp

示例3: add_related_elements

void ComponentDiagramView::add_related_elements(DiagramItem *  di, QString what,
						bool inh, bool assoc) {
  BrowserNodeList l;
  RelatedElementsDialog dialog(di->get_bn(), what, inh, assoc, l);
  
  dialog.raise();
  
  if (dialog.exec() == QDialog::Accepted) {
    QApplication::setOverrideCursor(Qt::waitCursor);
  
    DiagramItemList items(canvas()->allItems());
    Q3PtrDict<DiagramItem> drawn;
    
    get_drawn(items, drawn);
    history_save();
    history_protected = TRUE;
    
    int xmax = canvas()->width() - Diagram_Margin;
    int ymax = canvas()->height() - Diagram_Margin;
    QRect re = di->rect();
    int x = re.x();
    int y = re.bottom() + Diagram_Margin;
    int future_y = y;
    Q3PtrListIterator<BrowserNode> it(l);
    BrowserNode * bn;
    
    for (; (bn = it.current()) != 0; ++it) {
      if (drawn[bn->get_data()] == 0) {
	DiagramCanvas * dc;
	
	switch (bn->get_type()) {
	case UmlComponent:
	  dc = new ComponentCanvas(bn, the_canvas(), x, y);
	  break;
	case UmlPackage:
	  dc = new PackageCanvas(bn, the_canvas(), x, y, 0);
	  break;
	default:
	  continue;
	}
	
	drawn.replace(dc->get_bn()->get_data(), dc);
	
	if ((x + dc->width()) > xmax)
	  dc->move(x = Diagram_Margin, y = future_y);
	
	if (y + dc->height() > ymax) {
	  dc->move(x = Diagram_Margin, y = Diagram_Margin);
	  future_y = y + dc->height() + Diagram_Margin;
	}
	else {
	  int bot = y + dc->height() + Diagram_Margin;
	  
	  if (bot > future_y)
	    future_y = bot;
	}
	
	x = x + dc->width() + Diagram_Margin;
	
	dc->show();
	dc->upper();
      }
    }
    
    canvas()->update();
    history_protected = FALSE;
    window()->package_modified();
  
    QApplication::restoreOverrideCursor();
  }
}
开发者ID:kralf,项目名称:bouml,代码行数:71,代码来源:ComponentDiagramView.cpp

示例4: add_marked_elements

void ComponentDiagramView::add_marked_elements(const QPoint& p,
					       Q3PtrDict<DiagramItem> & drawn) {
  QApplication::setOverrideCursor(Qt::waitCursor);
  
  history_save();
  history_protected = TRUE;
  
  int xmax = canvas()->width() - Diagram_Margin;
  int ymax = canvas()->height() - Diagram_Margin;
  int x = p.x();
  int y = p.y();
  int future_y = y;
  const Q3PtrList<BrowserNode> & l = BrowserNode::marked_nodes();
  Q3PtrListIterator<BrowserNode> it(l);
  BrowserNode * bn;

  for (; (bn = it.current()) != 0; ++it) {
    if (drawn[bn->get_data()] == 0) {
      DiagramCanvas * dc;
      
      switch (bn->get_type()) {
      case UmlComponent:
	dc = new ComponentCanvas(bn, the_canvas(), x, y);
	break;
      case UmlPackage:
	dc = new PackageCanvas(bn, the_canvas(), x, y, 0);
	break;
      default:
	continue;
      }

      drawn.replace(dc->get_bn()->get_data(), dc);
      
      if ((x + dc->width()) > xmax)
	dc->move(x = Diagram_Margin, y = future_y);
      
      if (y + dc->height() > ymax) {
	dc->move(x = Diagram_Margin, y = Diagram_Margin);
	future_y = y + dc->height() + Diagram_Margin;
      }
      else {
	int bot = y + dc->height() + Diagram_Margin;
	
	if (bot > future_y)
	  future_y = bot;
      }
      
      x = x + dc->width() + Diagram_Margin;
      
      dc->show();
      dc->upper();
    }
  }
  
  UmlCanvas * cnv = (UmlCanvas *) canvas();
  
  if (! cnv->must_draw_all_relations()) {
    for (it.toFirst(); (bn = it.current()) != 0; ++it) {
      if ((drawn[bn->get_data()] == 0) &&
	  IsaSimpleRelation(bn->get_type()))
	SimpleRelationCanvas::drop(bn, cnv, drawn);
    }
  }
  
  canvas()->update();
  history_protected = FALSE;
  window()->package_modified();
  
  QApplication::restoreOverrideCursor();
}
开发者ID:kralf,项目名称:bouml,代码行数:70,代码来源:ComponentDiagramView.cpp


注:本文中的Q3PtrDict::replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。