MCPcopy Create free account
hub / github.com/Qucs/qucs / drawContents

Method drawContents

qucs/schematic.cpp:396–510  ·  view source on GitHub ↗

----------------------------------------------------------- Is called when the content (schematic or data display) has to be drawn.

Source from the content-addressed store, hash-verified

394// -----------------------------------------------------------
395// Is called when the content (schematic or data display) has to be drawn.
396void Schematic::drawContents(QPainter *p, int, int, int, int)
397{
398 ViewPainter Painter;
399
400 Painter.init(p, Scale, -ViewX1, -ViewY1, contentsX(), contentsY());
401
402 paintGrid(&Painter, contentsX(), contentsY(),
403 visibleWidth(), visibleHeight());
404
405 if(!symbolMode)
406 paintFrame(&Painter);
407
408 for(Component *pc = Components->first(); pc != 0; pc = Components->next())
409 pc->paint(&Painter);
410
411 for(Wire *pw = Wires->first(); pw != 0; pw = Wires->next()) {
412 pw->paint(&Painter);
413 if(pw->Label)
414 pw->Label->paint(&Painter); // separate because of paintSelected
415 }
416
417 Node *pn;
418 for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) {
419 pn->paint(&Painter);
420 if(pn->Label)
421 pn->Label->paint(&Painter); // separate because of paintSelected
422 }
423
424 // FIXME disable here, issue with select box goes away
425 // also, instead of red, line turns blue
426 for(Diagram *pd = Diagrams->first(); pd != 0; pd = Diagrams->next())
427 pd->paint(&Painter);
428
429 for(Painting *pp = Paintings->first(); pp != 0; pp = Paintings->next())
430 pp->paint(&Painter);
431
432 if(showBias > 0) { // show DC bias points in schematic ?
433 int x, y, z;
434 for(pn = Nodes->first(); pn != 0; pn = Nodes->next()) {
435 if(pn->Name.isEmpty()) continue;
436 x = pn->cx;
437 y = pn->cy + 4;
438 z = pn->x1;
439 if(z & 1) x -= Painter.Painter->fontMetrics().width(pn->Name);
440 if(!(z & 2)) {
441 y -= (Painter.LineSpacing>>1) + 4;
442 if(z & 1) x -= 4;
443 else x += 4;
444 }
445 if(z & 0x10)
446 Painter.Painter->setPen(Qt::darkGreen); // green for currents
447 else
448 Painter.Painter->setPen(Qt::blue); // blue for voltages
449 Painter.drawText(pn->Name, x, y);
450 }
451 }
452
453 /*

Callers

nothing calls this directly

Calls 12

nextMethod · 0.80
drawTextMethod · 0.80
sizeMethod · 0.80
drawRectMethod · 0.80
drawLineMethod · 0.80
drawEllipseMethod · 0.80
drawArcMethod · 0.80
scaleMethod · 0.80
initMethod · 0.45
paintMethod · 0.45
isEmptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected