MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / TraditionalView

Method TraditionalView

cp-profiler/src/cpprofiler/tree/traditional_view.cpp:43–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41{
42
43TraditionalView::TraditionalView(const NodeTree &tree, UserData &ud, SolverData &sd)
44 : tree_(tree),
45 user_data_(ud),
46 solver_data_(sd),
47 vis_flags_(utils::make_unique<VisualFlags>()),
48 layout_(utils::make_unique<Layout>()),
49 layout_computer_(utils::make_unique<LayoutComputer>(tree, *layout_, *vis_flags_))
50{
51 utils::DebugMutexLocker tree_lock(&tree_.treeMutex());
52
53 scroll_area_.reset(new TreeScrollArea(tree_.getRoot(), tree_, user_data_, *layout_, *vis_flags_));
54
55 // std::cerr << "traditional view thread:" << std::this_thread::get_id() << std::endl;
56
57 // connect(scroll_area_.get(), &TreeScrollArea::nodeClicked, this, &TraditionalView::setCurrentNode);
58 connect(scroll_area_.get(), &TreeScrollArea::nodeClicked, this, &TraditionalView::nodeSelected);
59 connect(scroll_area_.get(), &TreeScrollArea::nodeDoubleClicked, this, &TraditionalView::handleDoubleClick);
60
61 connect(this, &TraditionalView::needsRedrawing, this, &TraditionalView::redraw);
62 connect(this, &TraditionalView::needsLayoutUpdate, this, &TraditionalView::updateLayout);
63
64 connect(&tree, &NodeTree::childrenStructureChanged, [this](NodeID nid) {
65 if (nid == NodeID::NoNode)
66 {
67 return;
68 }
69 layout_computer_->dirtyUpLater(nid);
70 // layout_->setLayoutDone(nid, false);
71 });
72
73 auto autoLayoutTimer = new QTimer(this);
74
75 connect(autoLayoutTimer, &QTimer::timeout, this, &TraditionalView::autoUpdate);
76
77 /// stop this timer up when the tree is finished?
78 autoLayoutTimer->start(100);
79}
80
81TraditionalView::~TraditionalView() = default;
82

Callers

nothing calls this directly

Calls 5

dirtyUpLaterMethod · 0.80
resetMethod · 0.45
getRootMethod · 0.45
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected