43 const Options& opt) : QWidget(parent) {
44 QGridLayout* layout =
new QGridLayout(
this);
46 QAbstractScrollArea* scrollArea =
new QAbstractScrollArea(
this);
48 scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
49 scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
50 scrollArea->setAutoFillBackground(
true);
51 QPalette myPalette(scrollArea->palette());
52 myPalette.setColor(QPalette::Window, Qt::white);
53 scrollArea->setPalette(myPalette);
54 canvas =
new TreeCanvas(root,
bab, scrollArea->viewport(),opt);
55 canvas->setPalette(myPalette);
56 canvas->setObjectName(
"canvas");
58 connect(scrollArea->horizontalScrollBar(), SIGNAL(valueChanged(
int)),
59 canvas, SLOT(scroll(
void)));
60 connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(
int)),
61 canvas, SLOT(scroll(
void)));
63 QVBoxLayout* sa_layout =
new QVBoxLayout();
64 sa_layout->setContentsMargins(0,0,0,0);
65 sa_layout->addWidget(canvas);
66 scrollArea->viewport()->setLayout(sa_layout);
76 QToolButton* autoZoomButton =
new QToolButton();
77 autoZoomButton->setCheckable(
true);
78 autoZoomButton->setIcon(myPic);
82 inspect =
new QAction(
"Inspect",
this);
83 inspect->setShortcut(QKeySequence(
"Return"));
84 connect(
inspect, SIGNAL(triggered()), canvas,
85 SLOT(inspectCurrentNode()));
92 stop =
new QAction(
"Stop search",
this);
93 stop->setShortcut(QKeySequence(
"Esc"));
94 connect(
stop, SIGNAL(triggered()), canvas,
97 reset =
new QAction(
"Reset",
this);
98 reset->setShortcut(QKeySequence(
"Ctrl+R"));
99 connect(
reset, SIGNAL(triggered()), canvas,
102 navUp =
new QAction(
"Up",
this);
103 navUp->setShortcut(QKeySequence(
"Up"));
104 connect(
navUp, SIGNAL(triggered()), canvas,
107 navDown =
new QAction(
"Down",
this);
108 navDown->setShortcut(QKeySequence(
"Down"));
109 connect(
navDown, SIGNAL(triggered()), canvas,
112 navLeft =
new QAction(
"Left",
this);
113 navLeft->setShortcut(QKeySequence(
"Left"));
114 connect(
navLeft, SIGNAL(triggered()), canvas,
117 navRight =
new QAction(
"Right",
this);
118 navRight->setShortcut(QKeySequence(
"Right"));
119 connect(
navRight, SIGNAL(triggered()), canvas,
122 navRoot =
new QAction(
"Root",
this);
123 navRoot->setShortcut(QKeySequence(
"R"));
124 connect(
navRoot, SIGNAL(triggered()), canvas,
127 navNextSol =
new QAction(
"To next solution",
this);
128 navNextSol->setShortcut(QKeySequence(
"Shift+Right"));
129 connect(
navNextSol, SIGNAL(triggered()), canvas,
132 navPrevSol =
new QAction(
"To previous solution",
this);
133 navPrevSol->setShortcut(QKeySequence(
"Shift+Left"));
134 connect(
navPrevSol, SIGNAL(triggered()), canvas,
137 searchNext =
new QAction(
"Next solution",
this);
139 connect(
searchNext, SIGNAL(triggered()), canvas, SLOT(searchOne()));
141 searchAll =
new QAction(
"All solutions",
this);
142 searchAll->setShortcut(QKeySequence(
"A"));
149 hideFailed =
new QAction(
"Hide failed subtrees",
this);
153 unhideAll =
new QAction(
"Unhide all",
this);
154 unhideAll->setShortcut(QKeySequence(
"U"));
162 labelPath =
new QAction(
"Label/clear path",
this);
163 labelPath->setShortcut(QKeySequence(
"Shift+L"));
167 toggleStop =
new QAction(
"Stop/unstop",
this);
171 unstopAll =
new QAction(
"Do not stop in subtree",
this);
172 unstopAll->setShortcut(QKeySequence(
"Shift+X"));
175 zoomToFit =
new QAction(
"Zoom to fit",
this);
176 zoomToFit->setShortcut(QKeySequence(
"Z"));
179 center =
new QAction(
"Center current node",
this);
180 center->setShortcut(QKeySequence(
"C"));
181 connect(
center, SIGNAL(triggered()), canvas, SLOT(centerCurrentNode()));
183 exportPDF =
new QAction(
"Export subtree PDF...",
this);
184 exportPDF->setShortcut(QKeySequence(
"P"));
185 connect(
exportPDF, SIGNAL(triggered()), canvas,
193 print =
new QAction(
"Print...",
this);
194 print->setShortcut(QKeySequence(
"Ctrl+P"));
195 connect(
print, SIGNAL(triggered()), canvas,
198 bookmarkNode =
new QAction(
"Add/remove bookmark",
this);
205 canvas, SLOT(startCompareNodes()));
210 canvas, SLOT(startCompareNodesBeforeFP()));
212 connect(canvas, SIGNAL(addedBookmark(
const QString&)),
213 this, SLOT(addBookmark(
const QString&)));
214 connect(canvas, SIGNAL(removedBookmark(
int)),
215 this, SLOT(removeBookmark(
int)));
217 nullBookmark =
new QAction(
"<none>",
this);
218 nullBookmark->setCheckable(
true);
219 nullBookmark->setChecked(
false);
220 nullBookmark->setEnabled(
false);
225 this, SLOT(selectBookmark(QAction*)));
227 bookmarksMenu =
new QMenu(
"Bookmarks");
228 connect(bookmarksMenu, SIGNAL(aboutToShow()),
229 this, SLOT(populateBookmarksMenu()));
232 setPath =
new QAction(
"Set path",
this);
233 setPath->setShortcut(QKeySequence(
"Shift+P"));
243 this, SLOT(showStats()));
278 nullSolutionInspector =
new QAction(
"<none>",
this);
279 nullSolutionInspector->setCheckable(
true);
280 nullSolutionInspector->setChecked(
false);
281 nullSolutionInspector->setEnabled(
false);
286 this, SLOT(selectSolutionInspector(QAction*)));
288 nullDoubleClickInspector =
new QAction(
"<none>",
this);
289 nullDoubleClickInspector->setCheckable(
true);
290 nullDoubleClickInspector->setChecked(
false);
291 nullDoubleClickInspector->setEnabled(
false);
296 this, SLOT(selectDoubleClickInspector(QAction*)));
298 nullMoveInspector =
new QAction(
"<none>",
this);
299 nullMoveInspector->setCheckable(
true);
300 nullMoveInspector->setChecked(
false);
301 nullMoveInspector->setEnabled(
false);
306 this, SLOT(selectMoveInspector(QAction*)));
308 nullComparator =
new QAction(
"<none>",
this);
309 nullComparator->setCheckable(
true);
310 nullComparator->setChecked(
false);
311 nullComparator->setEnabled(
false);
316 this, SLOT(selectComparator(QAction*)));
318 solutionInspectorMenu =
new QMenu(
"Solution inspectors");
320 doubleClickInspectorMenu =
new QMenu(
"Double click inspectors");
321 doubleClickInspectorMenu->addActions(
323 moveInspectorMenu =
new QMenu(
"Move inspectors");
325 comparatorMenu =
new QMenu(
"Comparators");
330 this, SLOT(inspectWithAction(QAction*)));
333 this, SLOT(inspectBeforeFPWithAction(QAction*)));
335 inspectNodeMenu =
new QMenu(
"Inspect");
336 inspectNodeMenu->addAction(
inspect);
337 connect(inspectNodeMenu, SIGNAL(aboutToShow()),
338 this, SLOT(populateInspectors()));
340 inspectNodeBeforeFPMenu =
new QMenu(
"Inspect before fixpoint");
342 connect(inspectNodeBeforeFPMenu, SIGNAL(aboutToShow()),
343 this, SLOT(populateInspectors()));
344 populateInspectors();
346 contextMenu =
new QMenu(
this);
347 contextMenu->addMenu(inspectNodeMenu);
348 contextMenu->addMenu(inspectNodeBeforeFPMenu);
352 contextMenu->addAction(
center);
354 contextMenu->addSeparator();
359 contextMenu->addSeparator();
370 contextMenu->addSeparator();
372 contextMenu->addMenu(bookmarksMenu);
373 contextMenu->addAction(
setPath);
376 contextMenu->addSeparator();
378 contextMenu->addMenu(doubleClickInspectorMenu);
379 contextMenu->addMenu(solutionInspectorMenu);
380 contextMenu->addMenu(moveInspectorMenu);
382 connect(autoZoomButton, SIGNAL(toggled(
bool)), canvas,
385 connect(canvas, SIGNAL(autoZoomChanged(
bool)),
386 autoZoomButton, SLOT(setChecked(
bool)));
390 while (opt.inspect.solution(i)) {
394 while (opt.inspect.click(i)) {
398 while (opt.inspect.move(i)) {
402 while (opt.inspect.compare(i)) {
408 layout->addWidget(scrollArea, 0,0,-1,1);
409 layout->addWidget(canvas->scaleBar, 1,1, Qt::AlignHCenter);
410 layout->addWidget(autoZoomButton, 0,1, Qt::AlignHCenter);
419 QMetaObject::connectSlotsByName(
this);