| 40 | namespace Gecode { namespace Gist { |
| 41 | |
| 42 | NodeStatInspector::NodeStatInspector(QWidget* parent) |
| 43 | : QWidget(parent) { |
| 44 | setWindowFlags(Qt::Tool); |
| 45 | QGraphicsScene* scene = new QGraphicsScene(); |
| 46 | |
| 47 | scene->addEllipse(70,10,16,16,QPen(),QBrush(DrawingCursor::white)); |
| 48 | scene->addEllipse(70,60,16,16,QPen(),QBrush(DrawingCursor::blue)); |
| 49 | scene->addRect(32,100,12,12,QPen(),QBrush(DrawingCursor::red)); |
| 50 | |
| 51 | QPolygonF poly; |
| 52 | poly << QPointF(78,100) << QPointF(78+8,100+8) |
| 53 | << QPointF(78,100+16) << QPointF(78-8,100+8); |
| 54 | scene->addPolygon(poly,QPen(),QBrush(DrawingCursor::green)); |
| 55 | |
| 56 | scene->addEllipse(110,100,16,16,QPen(),QBrush(DrawingCursor::white)); |
| 57 | |
| 58 | QPen pen; |
| 59 | pen.setStyle(Qt::DotLine); |
| 60 | pen.setWidth(0); |
| 61 | scene->addLine(78,26,78,60,pen); |
| 62 | scene->addLine(78,76,38,100,pen); |
| 63 | scene->addLine(78,76,78,100,pen); |
| 64 | scene->addLine(78,76,118,100,pen); |
| 65 | |
| 66 | scene->addLine(135,10,145,10); |
| 67 | scene->addLine(145,10,145,110); |
| 68 | scene->addLine(145,60,135,60); |
| 69 | scene->addLine(145,110,135,110); |
| 70 | |
| 71 | nodeDepthLabel = scene->addText("0"); |
| 72 | nodeDepthLabel->setPos(150,20); |
| 73 | subtreeDepthLabel = scene->addText("0"); |
| 74 | subtreeDepthLabel->setPos(150,75); |
| 75 | |
| 76 | choicesLabel = scene->addText("0"); |
| 77 | choicesLabel->setPos(45,57); |
| 78 | |
| 79 | solvedLabel = scene->addText("0"); |
| 80 | solvedLabel->setPos(78-solvedLabel->document()->size().width()/2,120); |
| 81 | failedLabel = scene->addText("0"); |
| 82 | failedLabel->setPos(30,120); |
| 83 | openLabel = scene->addText("0"); |
| 84 | openLabel->setPos(110,120); |
| 85 | |
| 86 | QGraphicsView* view = new QGraphicsView(scene); |
| 87 | view->setRenderHints(view->renderHints() | QPainter::Antialiasing); |
| 88 | view->show(); |
| 89 | |
| 90 | scene->setBackgroundBrush(Qt::white); |
| 91 | |
| 92 | boxLayout = new QVBoxLayout(); |
| 93 | boxLayout->setContentsMargins(0,0,0,0); |
| 94 | boxLayout->addWidget(view); |
| 95 | setLayout(boxLayout); |
| 96 | |
| 97 | setWindowTitle("Gist node statistics"); |
| 98 | setAttribute(Qt::WA_QuitOnClose, false); |
| 99 | setAttribute(Qt::WA_DeleteOnClose, false); |