MCPcopy Create free account
hub / github.com/Gecode/gecode / print

Method print

gecode/gist/treecanvas.cpp:1089–1123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1087 }
1088
1089 void
1090 TreeCanvas::print(void) {
1091 QPrinter printer;
1092 if (QPrintDialog(&printer, this).exec() == QDialog::Accepted) {
1093 QMutexLocker locker(&mutex);
1094
1095 BoundingBox bb = root->getBoundingBox();
1096#if QT_VERSION >= 0x060000
1097 QRect pageRect = printer.pageLayout().paintRectPixels(printer.resolution());
1098#else
1099 QRect pageRect = printer.pageRect();
1100#endif
1101 double newXScale =
1102 static_cast<double>(pageRect.width()) / (bb.right - bb.left +
1103 Layout::extent);
1104 double newYScale =
1105 static_cast<double>(pageRect.height()) /
1106 (root->getShape()->depth() * Layout::dist_y +
1107 2*Layout::extent);
1108 double printScale = std::min(newXScale, newYScale)*100;
1109 if (printScale<1.0)
1110 printScale = 1.0;
1111 if (printScale > 400.0)
1112 printScale = 400.0;
1113 printScale = printScale / 100.0;
1114
1115 QPainter painter(&printer);
1116 painter.setRenderHint(QPainter::Antialiasing);
1117 painter.scale(printScale,printScale);
1118 painter.translate(xtrans, 0);
1119 QRect clip(0,0,0,0);
1120 DrawingCursor dc(root, *na, curBest, painter, clip, showCopies);
1121 PreorderNodeVisitor<DrawingCursor>(dc).run();
1122 }
1123 }
1124
1125 VisualNode*
1126 TreeCanvas::eventNode(QEvent* event) {

Callers 3

getBranchLabelMethod · 0.45
getNumberOfChildNodesMethod · 0.45
inspectMethod · 0.45

Calls 9

execMethod · 0.80
getBoundingBoxMethod · 0.80
getShapeMethod · 0.80
minFunction · 0.50
widthMethod · 0.45
heightMethod · 0.45
depthMethod · 0.45
scaleMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected