50 #include <QApplication>
51 #include <QColorDialog>
53 #include <QInputDialog>
58 #include <QMessageBox>
61 #include <QStyleOptionGraphicsItem>
62 #include <QWheelEvent>
63 #include <QWidgetAction>
71 const QString GraphGraphicsView::sAssignToGrouping(
"Assign to grouping ");
75 mMinimapEnabled(false), mGridEnabled(true), mGridClustersEnabled(true),
78 mDragModifier(
Qt::KeyboardModifier::AltModifier),
79 mPanModifier(
Qt::KeyboardModifier::ShiftModifier),
80 mZoomModifier(
Qt::NoModifier),
81 mZoomFactorBase(1.0015)
94 void GraphGraphicsView::conditionalUpdate()
125 void GraphGraphicsView::handleIsolationViewAction()
133 if (selected_modules.size() == 1 && selected_gates.empty())
135 u32 module_id = *selected_modules.
begin();
144 UserActionCompound* act =
new UserActionCompound;
145 act->setUseCreatedObject();
148 act->addAction(
new ActionAddItemsToObject(selected_modules, selected_gates));
152 context->setExclusiveModuleId(module_id);
158 UserActionCompound* act =
new UserActionCompound;
159 act->setUseCreatedObject();
161 act->addAction(
new ActionAddItemsToObject(selected_modules, selected_gates));
167 void GraphGraphicsView::adjustMinScale()
174 void GraphGraphicsView::handleAddCommentAction()
179 auto node =
action->data().value<Node>();
180 CommentDialog commentDialog(
"New Comment");
183 commentDialog.close();
234 #ifdef GUI_DEBUG_GRID
236 debugDrawLayouterGridpos(painter);
239 if (!mMinimapEnabled)
247 #ifdef GUI_DEBUG_GRID
248 void GraphGraphicsView::debugDrawLayouterGridpos(
QPainter* painter)
267 mMovePosition =
event->pos();
272 if (item && itemDraggable(item))
274 mDragController->
set(item,
event->pos());
278 mDragController->
clear();
282 mousePressEventNotItemDrag(
event);
285 mousePressEventNotItemDrag(
event);
288 void GraphGraphicsView::mousePressEventNotItemDrag(
QMouseEvent *event)
308 QPointF delta = mTargetViewportPos -
event->pos();
310 if (qAbs(delta.
x()) > 5 || qAbs(delta.
y()) > 5)
312 mTargetViewportPos =
event->pos();
321 QPoint delta_move =
event->pos() - mMovePosition;
322 mMovePosition =
event->pos();
323 hBar->
setValue(hBar->
value() + (isRightToLeft() ? delta_move.
x() : -delta_move.
x()));
342 #ifdef GUI_DEBUG_GRID
343 debugShowLayouterGridpos(
event->pos());
353 mDragController->
enterDrag(
event->keyboardModifiers() == mDragModifier);
354 event->acceptProposedAction();
366 mDragController->
clear();
369 void GraphGraphicsView::dragPan(
float dpx,
float dpy)
374 int hValue = hBar->
value() + 10*dpx;
375 if (hValue < hBar->minimum()) hBar->
setMinimum(hValue);
382 int vValue = vBar->
value() + 10*dpy;
383 if (vValue < vBar->minimum()) vBar->
setMinimum(vValue);
395 mDragController->
move(
event->pos(),
event->keyboardModifiers() == mDragModifier,snap.first);
403 if (rx < 10) dpx = -10+rx;
404 if (rx > 90) dpx = rx-90;
405 if (ry < 10) dpy = -10+ry;
406 if (ry > 90) dpy = ry-90;
407 if (dpx !=0 || dpy != 0)
416 event->acceptProposedAction();
422 assert(layouter->
done());
433 mDragController->
clear();
442 qreal angle =
event->angleDelta().y();
443 qreal factor = qPow(mZoomFactorBase, angle);
451 switch (
event->key())
464 switch (
event->key())
481 void GraphGraphicsView::showContextMenu(
const QPoint& pos)
488 QMenu context_menu(
this);
493 bool isModule =
false;
540 if (isGate || isModule)
542 QMenu* preSucMenu = context_menu.
addMenu(
"Successor/Predecessor …");
543 recursionLevelMenu(preSucMenu->
addMenu(
"Add successors to view …"),
true, &GraphGraphicsView::handleAddSuccessorToView);
545 recursionLevelMenu(preSucMenu->
addMenu(
"Add common successors to view …"),
true, &GraphGraphicsView::handleAddCommonSuccessorToView);
548 action = preSucMenu->
addAction(
"Add path to successor gate to view …");
549 action->setData(SuccessorGate);
551 action = preSucMenu->
addAction(
"Add path to successor module to view …");
552 action->setData(SuccessorModule);
555 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight successors …"),
true, &GraphGraphicsView::handleHighlightSuccessor,
true);
556 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight successors by distance …"),
true, &GraphGraphicsView::handleSuccessorDistance);
559 action = preSucMenu->
addAction(
"Highlight path to successor gate …");
560 action->setData(SuccessorGate);
562 action = preSucMenu->
addAction(
"Highlight path to successor module …");
563 action->setData(SuccessorModule);
568 recursionLevelMenu(preSucMenu->
addMenu(
"Add predecessors to view …"),
false, &GraphGraphicsView::handleAddPredecessorToView);
570 recursionLevelMenu(preSucMenu->
addMenu(
"Add common predecessors to view …"),
false, &GraphGraphicsView::handleAddCommonPredecessorToView);
573 action = preSucMenu->
addAction(
"Add path to predecessor gate to view …");
574 action->setData(PredecessorGate);
576 action = preSucMenu->
addAction(
"Add path to predecessor module to view …");
577 action->setData(PredecessorModule);
580 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight predecessors …"),
false, &GraphGraphicsView::handleHighlightPredecessor,
true);
581 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight predecessors by distance …"),
false, &GraphGraphicsView::handlePredecessorDistance);
584 action = preSucMenu->
addAction(
"Highlight path to predecessor gate …");
585 action->setData(PredecessorGate);
587 action = preSucMenu->
addAction(
"Highlight path to predecessor module …");
588 action->setData(PredecessorModule);
593 action = context_menu.addAction(
"Remove selected items from view");
598 action = context_menu.addAction(
"Cancel pick-item mode");
610 if(isGate || isModule)
612 action = context_menu.addAction(
" Fold parent module");
617 action = context_menu.addAction(
" Unfold module");
626 action = context_menu.addAction(
" Fold all parent modules");
628 action = context_menu.addAction(
" Isolate all in new view");
630 action = context_menu.addAction(
" Unfold all selected modules");
633 action = context_menu.addAction(
" Add comment");
635 data.setValue(Node(mItem->
id(), isGate ? Node::NodeType::Gate : Node::NodeType::Module));
642 context_menu.addAction(
"This view:")->setEnabled(
false);
644 action = context_menu.addAction(
" Add module to view");
647 int selectable_modules_count = 0;
648 QSet<u32> not_selectable_modules = getNotSelectableModules();
651 if (!not_selectable_modules.
contains(m->get_id()))
652 selectable_modules_count++;
654 if (selectable_modules_count == 0)
655 action->setDisabled(
true);
657 action = context_menu.addAction(
" Add gate to view");
659 if (getSelectableGates().empty())
660 action->setDisabled(
true);
684 void GraphGraphicsView::handlePluginContextContributionTriggered()
688 ContextMenuContribution* cmc =
static_cast<ContextMenuContribution*
>(act->
data().
value<
void*>());
690 Q_ASSERT(cmc->mContributer);
691 cmc->mContributer->execute_function(cmc->mTagname,
gNetlist,
699 void GraphGraphicsView::updateMatrix(
const int delta)
701 qreal
scale = qPow(2.0, delta / 100.0);
708 void GraphGraphicsView::toggleAntialiasing()
713 bool GraphGraphicsView::itemDraggable(GraphicsItem* item)
721 scale(factor, factor);
731 scale(factor, factor);
735 void GraphGraphicsView::handleCancelPickMode()
740 namespace ShortestPath
753 const Module* parent =
g->get_module();
766 void GraphGraphicsView::handleAddModuleToView()
768 GraphContext* context = mGraphWidget->
getContext();
837 ModuleDialog module_dialog(getNotSelectableModules(),
"Add module to view",
true,
nullptr,
this);
841 module_to_add.
insert(module_dialog.selectedId());
842 ActionAddItemsToObject* act =
new ActionAddItemsToObject(module_to_add, {});
849 QSet<u32> GraphGraphicsView::getNotSelectableModules()
851 GraphContext* context = mGraphWidget->
getContext();
854 QSet<u32> modules_in_context = context->modules();
855 QSet<u32> gates_in_context = context->gates();
859 bool module_in_context =
false;
862 if (modules_in_context.
contains(submodule->get_id()))
864 module_in_context =
true;
870 if (gates_in_context.
contains(subgate->get_id()))
872 module_in_context =
true;
876 if (module_in_context)
882 not_selectable_modules += modules_in_context;
885 for (
u32 id : modules_in_context)
893 if (!cur_module->is_top_module())
895 direct_par_modules.
insert(cur_module->get_parent_module()->get_id());
899 if (!gates_in_context.
empty())
901 for (
u32 id : gates_in_context)
907 for (
u32 id : direct_par_modules)
909 not_selectable_modules.
insert(
id);
912 while (!tmp_module->is_top_module())
914 Module* par_module = tmp_module->get_parent_module();
915 tmp_module = par_module;
916 not_selectable_modules.
insert(par_module->get_id());
920 return not_selectable_modules;
923 QSet<u32> GraphGraphicsView::getSelectableGates()
925 GraphContext* context = mGraphWidget->
getContext();
927 QSet<u32> not_selectable_gates = context->gates();
928 QSet<u32> modules_in_context = context->modules();
930 for (
u32 module_id : modules_in_context)
934 not_selectable_gates.
insert(gate->get_id());
941 if (!not_selectable_gates.
contains(gate->get_id()))
943 selectable_gates.
insert(gate->get_id());
947 return selectable_gates;
950 void GraphGraphicsView::handleAddGateToView()
952 QSet<u32> selectable_gates = getSelectableGates();
954 GraphContext* context = mGraphWidget->
getContext();
956 GateDialog gate_dialog(selectable_gates,
"Add gate to view",
nullptr,
this);
960 gate_to_add.
insert(gate_dialog.selectedId());
961 ActionAddItemsToObject* act =
new ActionAddItemsToObject({}, gate_to_add);
968 void GraphGraphicsView::handleAddSuccessorToView()
973 addSuccessorToView(level,
true);
976 void GraphGraphicsView::handleAddPredecessorToView()
981 addSuccessorToView(level,
false);
984 void GraphGraphicsView::handleAddCommonSuccessorToView()
989 addCommonSuccessorToView(level,
true);
992 void GraphGraphicsView::handleAddCommonPredecessorToView()
997 addCommonSuccessorToView(level,
false);
1000 void GraphGraphicsView::addSuccessorToView(
int maxLevel,
bool succ)
1024 Q_ASSERT(startList.
size());
1026 for (
const Gate*
g : startList)
1030 const NodeBox* box = boxes.
boxForNode(startNode);
1032 int xOrigin = box->x();
1033 int yOrigin = box->y();
1034 int xDir = succ ? 1 : -1;
1038 for (
int loop = 0; !maxLevel || loop<maxLevel; loop++)
1043 for (
const Gate* gOrigin : startList)
1049 if (boxes.boxForGate(
g))
continue;
1054 if (foundList.
isEmpty())
break;
1055 for (
const Gate*
g: foundList)
1058 QPoint point(xOrigin + (loop+1) * xDir, yOrigin +
y);
1059 y =
y > 0 ? -
y : -
y+1;
1061 if (!boxes.boxForPoint(point))
1065 plc.addGridPosition(nd,point);
1068 startList = foundList;
1071 ActionAddItemsToObject* act =
new ActionAddItemsToObject({}, gatsNew);
1073 act->setPlacementHint(plc);
1078 void GraphGraphicsView::addCommonSuccessorToView(
int maxLevel,
bool succ)
1084 for (
const Gate*
g : csp.result())
1086 if (boxes.boxForGate(
g))
continue;
1089 ActionAddItemsToObject* act =
new ActionAddItemsToObject({}, gatsNew);
1094 void GraphGraphicsView::handleHighlightSuccessor()
1102 void GraphGraphicsView::handleHighlightPredecessor()
1110 void GraphGraphicsView::handleSuccessorDistance()
1118 void GraphGraphicsView::handlePredecessorDistance()
1126 void GraphGraphicsView::handleShortestPathToView()
1132 bool succ = (param == SuccessorModule || param == SuccessorGate);
1133 bool isMod = (param == SuccessorModule || param == PredecessorModule);
1134 std::vector<Gate*> spath;
1136 Q_ASSERT(startGate);
1141 const Module* parMod = startGate->get_module();
1144 excludeModules.
insert(parMod->get_id());
1145 parMod = parMod->get_parent_module();
1148 ModuleDialog md(excludeModules,
"Shortest path to module",
true,
nullptr,
this);
1153 Q_ASSERT(endModule);
1163 selectableGates.
insert(
g->get_id());
1167 GateDialog gd(selectableGates,
QString(
"Shortest path %1 gate").arg(succ?
"to":
"from"),
nullptr,
this);
1181 if (spath.empty())
return;
1182 if (!succ) std::reverse(spath.begin(), spath.end());
1185 const NodeBox* originBox = boxes.
boxForGate(startGate);
1186 Q_ASSERT(originBox);
1187 QPoint point(originBox->x(),originBox->y());
1188 QPoint deltaX(succ ? 1 : -1, 0);
1193 for (Gate*
g : spath)
1195 if (boxes.boxForGate(
g))
continue;
1198 }
while (boxes.boxForPoint(point));
1203 plc.addGridPosition(nd,point);
1206 ActionAddItemsToObject* act =
new ActionAddItemsToObject({},gats);
1208 act->setPlacementHint(plc);
1212 void GraphGraphicsView::handleQueryShortestPathModule()
1216 bool succ = send->
data().
toInt() == SuccessorGate;
1221 Module* par =
g->get_module();
1224 excludeModules.
insert(par->get_id());
1225 par = par->get_parent_module();
1227 ModuleDialog md(excludeModules,
"Shortest path to module",
true,
nullptr,
this);
1234 void GraphGraphicsView::handleQueryShortestPathGate()
1238 bool succ = send->
data().
toInt() == SuccessorGate;
1242 selectableGates.
insert(
g->get_id());
1244 GraphGraphicsViewNeighborSelector* ggvns =
new GraphGraphicsViewNeighborSelector(mItem->
id(), succ,
this);
1245 GateDialog gd(selectableGates,
QString(
"Shortest path %1 gate").arg(succ?
"to":
"from"),ggvns,
this);
1249 u32 targetId = gd.selectedId();
1250 if (!targetId)
return;
1260 std::vector<Gate*> spath;
1264 Q_ASSERT(!nodeTo.
isNull());
1272 spath = forwardDirection ?
1290 Gate* previousGate =
nullptr;
1291 for (
Gate*
g : spath)
1307 QString(
"Path from '%1'[%2] to %3")
1315 void GraphGraphicsView::handleSelectOutputs()
1325 for (
auto net : gate->get_fan_out_nets())
1327 for (
const auto& suc :
net->get_destinations())
1330 for (
const auto&
id : context->modules())
1333 if (m->contains_gate(suc->get_gate(),
true))
1341 gates.
insert(suc->get_gate()->get_id());
1351 for (
const auto& suc :
net->get_destinations())
1354 for (
const auto&
id : context->modules())
1357 if (m->contains_gate(suc->get_gate(),
true))
1365 gates.
insert(suc->get_gate()->get_id());
1371 gates = context->getLayouter()->boxes().filterNotInView(gates);
1372 ActionAddItemsToObject* act =
new ActionAddItemsToObject({},gates);
1384 void GraphGraphicsView::handleSelectInputs()
1394 for (
auto net : gate->get_fan_in_nets())
1396 if (!
net->get_sources().empty() &&
net->get_sources().at(0)->get_gate() !=
nullptr)
1399 for (
const auto&
id : context->modules())
1402 if (m->contains_gate(
net->get_sources().at(0)->get_gate(),
true))
1410 gates.
insert(
net->get_sources().at(0)->get_gate()->get_id());
1420 if (!
net->get_sources().empty() &&
net->get_sources().at(0)->get_gate() !=
nullptr)
1423 for (
const auto&
id : context->modules())
1426 if (m->contains_gate(
net->get_sources().at(0)->get_gate(),
true))
1434 gates.
insert(
net->get_sources().at(0)->get_gate()->get_id());
1440 gates = context->getLayouter()->boxes().filterNotInView(gates);
1441 ActionAddItemsToObject* act =
new ActionAddItemsToObject({},gates);
1454 void GraphGraphicsView::selectedNodeToItem()
1457 NodeBox* box =
nullptr;
1469 mItem = box->item();
1474 selectedNodeToItem();
1476 handleFoldParentSingle();
1481 selectedNodeToItem();
1483 handleUnfoldSingleAction();
1486 void GraphGraphicsView::handleFoldParentSingle()
1488 const Module* parentModule =
nullptr;
1490 u32 id = mItem->
id();
1512 ActionFoldModule* act =
new ActionFoldModule(parentModule->
get_id());
1513 act->setContextId(context->
id());
1514 act->setPlacementHint(plc);
1518 void GraphGraphicsView::handleUnfoldSingleAction()
1520 GraphContext* context = mGraphWidget->
getContext();
1522 if (m->get_gates().empty() && m->get_submodules().empty())
1525 msg.
setText(
"This module is empty.\nYou can't unfold it.");
1532 ActionUnfoldModule* act =
new ActionUnfoldModule(mItem->
id());
1533 act->setContextId(context->id());
1537 void GraphGraphicsView::handleFoldParentAll()
1539 GraphContext* context = mGraphWidget->
getContext();
1545 if (!context->getLayouter()->boxes().boxForNode(nd))
continue;
1560 for (
const Module* m : modSet)
1561 if (m) modDepth.
insertMulti(m->get_submodule_depth(),m);
1565 while (it.hasPrevious())
1568 const Module* m = it.value();
1569 ActionFoldModule* act =
new ActionFoldModule(m->get_id());
1570 act->setContextId(context->id());
1575 void GraphGraphicsView::handleUnfoldAllAction()
1580 UserActionCompound* act =
new UserActionCompound;
1583 ActionUnfoldModule* ufo =
new ActionUnfoldModule(
id);
1584 ufo->setContextId(context->id());
1585 act->addAction(ufo);
1588 context->endChange();
1591 #ifdef GUI_DEBUG_GRID
1592 void GraphGraphicsView::debugShowLayouterGridpos(
const QPoint& mouse_pos)
1598 const GraphLayouter* layouter = context->
getLayouter();
1599 if (!(layouter->done()))
1603 QPoint layouter_pos = closestLayouterPos(scene_mouse_pos).first;
1604 m_debug_gridpos = layouter_pos;
1613 const GraphLayouter* layouter = context->getLayouter();
1614 assert(layouter->done());
1616 int default_width = layouter->defaultGridWidth();
1617 int default_height = layouter->defaultGridHeight();
1618 int min_x = layouter->minXIndex();
1619 int min_y = layouter->minYIndex();
1622 LayouterPoint x_point = closestLayouterPoint(scene_pos.
x(), default_width, min_x, x_vals);
1623 LayouterPoint y_point = closestLayouterPoint(scene_pos.
y(), default_height, min_y, y_vals);
1624 return qMakePair(
QPoint(x_point.mIndex, y_point.mIndex),
QPointF(x_point.mPos, y_point.mPos));
1627 GraphGraphicsView::LayouterPoint GraphGraphicsView::closestLayouterPoint(qreal scene_pos,
int default_spacing,
int min_index,
QVector<qreal> sections)
const
1629 int index = min_index;
1631 if (sections.
first() > scene_pos)
1633 int distance = sections.
first() - scene_pos;
1634 int nSections = distance / default_spacing;
1635 index -= (nSections + 1);
1636 pos = sections.
first() + index * default_spacing;
1638 else if (sections.
last() <= scene_pos)
1640 int distance = scene_pos - sections.
last();
1641 int nSections = distance / default_spacing;
1642 index += (sections.
size() + nSections -1);
1643 pos = sections.
last() + nSections * default_spacing;
1652 if (scene_pos < *jt)
break;
1659 return LayouterPoint{index,
pos};
1675 return mDragModifier;
1685 return mPanModifier;
Adds an item to a module or grouping.
Removes an item from a Module or Grouping.
Set the selection and focus.
GraphTabWidget * getGraphTabWidget()
Get hal's graph tab widget.
GroupingManagerWidget * getGroupingManagerWidget()
ContextManagerWidget * getContextManagerWidget()
void selectViewContext(GraphContext *context)
GraphContext * getCurrentContext()
void handleOpenContextClicked()
GridPlacement * finalGridPlacement() const
void move(const QPoint &eventPos, bool wantSwap, const QPoint &gridPos)
bool hasDragged(const QPoint &eventPos)
void set(GraphicsNode *drgItem, const QPoint &eventPos)
bool isDropAllowed() const
void enterDrag(bool wantSwap)
const std::vector< Net * > & get_fan_in_nets() const
const std::string & get_name() const
Module * get_module() const
const std::vector< Net * > & get_fan_out_nets() const
Logical container for modules, gates, and nets.
const QSet< u32 > & gates() const
const QSet< u32 > & modules() const
GraphLayouter * getLayouter() const
QString nextViewName(const QString &prefix) const
GraphContext * getContextById(u32 id) const
GraphContext * getContextByExclusiveModuleId(u32 module_id) const
static SettingsItemCheckbox * sSettingPanOnMiddleButton
A view to display the rendered graph (needs a GraphicsScene).
void handleRemoveFromView()
void keyPressEvent(QKeyEvent *event) override
void dragLeaveEvent(QDragLeaveEvent *event) override
void setGridType(GraphicsScene::GridType gridType)
void dropEvent(QDropEvent *event) override
void wheelEvent(QWheelEvent *event) override
void setPanModifier(Qt::KeyboardModifier panModifier)
Qt::KeyboardModifier panModifier()
void keyReleaseEvent(QKeyEvent *event) override
void viewportCenterZoom(const qreal factor)
void handleShortestPathToGrouping(u32 idFrom, Node nodeTo, bool forwardDirection)
void setDragModifier(Qt::KeyboardModifier dragModifier)
GraphGraphicsView(GraphWidget *parent)
void paintEvent(QPaintEvent *event) override
void moduleDoubleClicked(u32 id)
void mouseMoveEvent(QMouseEvent *event) override
Qt::KeyboardModifier dragModifier()
void resizeEvent(QResizeEvent *event) override
void handleFoldModuleShortcut()
GraphicsScene::GridType gridType()
void dragEnterEvent(QDragEnterEvent *event) override
void mouseDoubleClickEvent(QMouseEvent *event) override
void mouseReleaseEvent(QMouseEvent *event) override
void mousePressEvent(QMouseEvent *event) override
void handleUnfoldModuleShortcut()
void drawForeground(QPainter *painter, const QRectF &rect) override
void gentleZoom(const qreal factor)
void dragMoveEvent(QDragMoveEvent *event) override
void handleGatesPicked(const QSet< u32 > &gats) override
Base class for all specific layouters.
const NodeBoxes & boxes() const
Superclass for all graphic items used ins the GraphicsScene. It contains information about the underl...
static void setLod(const qreal lod)
ItemType itemType() const
Abstract base class for nodes (e.g. gates, modules)
Container for a GraphGraphicsView containing gates, nets, and modules.
static void setLod(const qreal &lod)
void setMousePressed(bool isPressed)
static void setGridEnabled(const bool &value)
static void setGridType(const GridType &gridType)
static void setGridClustersEnabled(const bool &value)
static void addPluginSubmenus(QMenu *contextMenu, Netlist *netlist, const std::vector< u32 > &modules, const std::vector< u32 > &gates, const std::vector< u32 > &nets)
Module * get_parent_module() const
const std::vector< Gate * > & get_gates() const
std::string get_name() const
const std::unordered_set< Net * > & get_input_nets() const
std::vector< Module * > get_submodules(const std::function< bool(Module *)> &filter=nullptr, bool recursive=false) const
const std::unordered_set< Net * > & get_output_nets() const
const std::vector< Gate * > & get_gates() const
Gate * get_gate_by_id(const u32 gate_id) const
const std::vector< Module * > & get_modules() const
Module * get_module_by_id(u32 module_id) const
The NodeBoxes class owns all NodeBox'es from hal view.
NodeBox * boxForNode(const Node &n) const
boxForNode find NodeBox by node
NodeBox * boxForGate(const Gate *g) const
boxForGate find NodeBox by Gate pointer.
static void setLod(const qreal lod)
The Node class object represents a module or a gate.
NodeType type() const
type getter for type information
bool isGate() const
isGate test whether node is a gate
bool isNull() const
isNull test for null-Node object typically returned from functions
u32 id() const
id getter for ID information
int numberSelectedGates() const
int numberSelectedItems() const
bool containsGate(u32 id) const
void setFocus(ItemType ftype, u32 fid, Subfocus sfoc=Subfocus::None, u32 sfinx=0)
const QSet< u32 > & selectedNets() const
void relaySelectionChanged(void *sender)
QList< Node > selectedNodesList() const
QList< u32 > selectedModulesList() const
const QSet< u32 > & selectedGates() const
const QSet< u32 > & selectedModules() const
std::vector< u32 > selectedGatesVector() const
int numberSelectedModules() const
bool containsModule(u32 id) const
std::vector< u32 > selectedNetsVector() const
bool containsNet(u32 id) const
QList< u32 > selectedGatesList() const
std::vector< u32 > selectedModulesVector() const
void subfocusChanged(void *sender)
int numberSelectedNodes() const
static void updateAlpha()
virtual QVariant value() const override
static void updateAlpha()
static void updateAlpha()
static void updateAlpha()
void addAction(UserAction *act)
void setUseCreatedObject()
virtual void setObject(const UserActionObject &obj)
void setObjectLock(bool lock)
The UserActionObject class represents a single object used in UserAction.
ItemType
The ItemType enum provides the enum type to classify graphic items into Modules, Gates or Nets....
const Module * module(const Gate *g, const NodeBoxes &boxes)
const Net * net(const Gate *g0, const Gate *g1)
std::vector< Gate * > get_next_gates(const Gate *gate, bool get_successors, int depth, const std::function< bool(const Gate *)> &filter)
std::vector< Gate * > get_shortest_path(Gate *start_gate, Module *end_module, bool forward_direction)
PythonContext * gPythonContext
ContentManager * gContentManager
GraphContextManager * gGraphContextManager
SelectionRelay * gSelectionRelay
CommentManager * gCommentManager
QVariant data() const const
void triggered(bool checked)
Qt::DropAction exec(Qt::DropActions supportedActions)
void setMimeData(QMimeData *data)
QMatrix matrix() const const
void setMatrix(const QMatrix &matrix, bool combine)
void centerOn(const QPointF &pos)
virtual void dropEvent(QDropEvent *event) override
virtual bool event(QEvent *event) override
QGraphicsItem * itemAt(const QPoint &pos) const const
QPoint mapFromScene(const QPointF &point) const const
QPointF mapToScene(const QPoint &point) const const
virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mouseReleaseEvent(QMouseEvent *event) override
void setOptimizationFlags(QGraphicsView::OptimizationFlags flags)
virtual void paintEvent(QPaintEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
void scale(qreal sx, qreal sy)
QGraphicsScene * scene() const const
void setRenderHint(QPainter::RenderHint hint, bool enabled)
void setViewportUpdateMode(QGraphicsView::ViewportUpdateMode mode)
Qt::KeyboardModifiers keyboardModifiers()
void append(const T &value)
const T & at(int i) const const
bool isEmpty() const const
QMap::iterator insertMulti(const Key &key, const T &value)
QMatrix & scale(qreal sx, qreal sy)
virtual int exec() override
void setWindowTitle(const QString &title)
void setText(const QString &text)
void setText(const QString &text)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const const
QObject * sender() const const
void drawText(const QPointF &position, const QString &text)
void fillRect(const QRectF &rectangle, const QBrush &brush)
void setPen(const QColor &color)
QPoint toPoint() const const
QSet::const_iterator constBegin() const const
bool contains(const T &value) const const
QSet::iterator insert(const T &value)
bool isEmpty() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString fromStdString(const std::string &str)
QString number(int n, int base)
bool toBool() const const
int toInt(bool *ok) const const
QVector::const_iterator constBegin() const const
QVector::const_iterator constEnd() const const