52 #include <QApplication>
53 #include <QColorDialog>
55 #include <QInputDialog>
60 #include <QMessageBox>
63 #include <QStyleOptionGraphicsItem>
64 #include <QWheelEvent>
65 #include <QWidgetAction>
73 const QString GraphGraphicsView::sAssignToGrouping(
"Assign to grouping ");
77 mMinimapEnabled(false), mGridEnabled(true), mGridClustersEnabled(true),
80 mDragModifier(
Qt::KeyboardModifier::AltModifier),
81 mPanModifier(
Qt::KeyboardModifier::ShiftModifier),
82 mZoomModifier(
Qt::NoModifier),
83 mZoomFactorBase(1.0015)
96 void GraphGraphicsView::conditionalUpdate()
127 void GraphGraphicsView::handleIsolationViewAction()
135 if (selected_modules.size() == 1 && selected_gates.empty())
137 u32 module_id = *selected_modules.
begin();
146 UserActionCompound* act =
new UserActionCompound;
147 act->setUseCreatedObject();
150 act->addAction(
new ActionAddItemsToObject(selected_modules, selected_gates));
154 context->setExclusiveModuleId(module_id);
160 UserActionCompound* act =
new UserActionCompound;
161 act->setUseCreatedObject();
163 act->addAction(
new ActionAddItemsToObject(selected_modules, selected_gates));
169 void GraphGraphicsView::adjustMinScale()
176 void GraphGraphicsView::handleAddCommentAction()
181 auto node =
action->data().value<Node>();
182 CommentDialog commentDialog(
"New Comment");
185 commentDialog.close();
236 #ifdef GUI_DEBUG_GRID
238 debugDrawLayouterGridpos(painter);
241 if (!mMinimapEnabled)
249 #ifdef GUI_DEBUG_GRID
250 void GraphGraphicsView::debugDrawLayouterGridpos(
QPainter* painter)
269 mMovePosition =
event->pos();
274 if (item && itemDraggable(item))
276 mDragController->
set(item,
event->pos());
280 mDragController->
clear();
284 mousePressEventNotItemDrag(
event);
287 mousePressEventNotItemDrag(
event);
290 void GraphGraphicsView::mousePressEventNotItemDrag(
QMouseEvent *event)
310 QPointF delta = mTargetViewportPos -
event->pos();
312 if (qAbs(delta.
x()) > 5 || qAbs(delta.
y()) > 5)
314 mTargetViewportPos =
event->pos();
323 QPoint delta_move =
event->pos() - mMovePosition;
324 mMovePosition =
event->pos();
325 hBar->
setValue(hBar->
value() + (isRightToLeft() ? delta_move.
x() : -delta_move.
x()));
344 #ifdef GUI_DEBUG_GRID
345 debugShowLayouterGridpos(
event->pos());
355 mDragController->
enterDrag(
event->keyboardModifiers() == mDragModifier);
356 event->acceptProposedAction();
368 mDragController->
clear();
371 void GraphGraphicsView::dragPan(
float dpx,
float dpy)
376 int hValue = hBar->
value() + 10*dpx;
377 if (hValue < hBar->minimum()) hBar->
setMinimum(hValue);
384 int vValue = vBar->
value() + 10*dpy;
385 if (vValue < vBar->minimum()) vBar->
setMinimum(vValue);
397 mDragController->
move(
event->pos(),
event->keyboardModifiers() == mDragModifier,snap.first);
405 if (rx < 10) dpx = -10+rx;
406 if (rx > 90) dpx = rx-90;
407 if (ry < 10) dpy = -10+ry;
408 if (ry > 90) dpy = ry-90;
409 if (dpx !=0 || dpy != 0)
418 event->acceptProposedAction();
424 assert(layouter->
done());
435 mDragController->
clear();
444 qreal angle =
event->angleDelta().y();
445 qreal factor = qPow(mZoomFactorBase, angle);
453 switch (
event->key())
466 switch (
event->key())
483 void GraphGraphicsView::showContextMenu(
const QPoint& pos)
490 QMenu context_menu(
this);
495 bool isModule =
false;
542 if (isGate || isModule)
544 QMenu* preSucMenu = context_menu.
addMenu(
"Successor/Predecessor …");
545 recursionLevelMenu(preSucMenu->
addMenu(
"Add successors to view …"),
true, &GraphGraphicsView::handleAddSuccessorToView);
547 recursionLevelMenu(preSucMenu->
addMenu(
"Add common successors to view …"),
true, &GraphGraphicsView::handleAddCommonSuccessorToView);
550 action = preSucMenu->
addAction(
"Add path to successor gate to view …");
551 action->setData(SuccessorGate);
553 action = preSucMenu->
addAction(
"Add path to successor module to view …");
554 action->setData(SuccessorModule);
557 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight successors …"),
true, &GraphGraphicsView::handleHighlightSuccessor,
true);
558 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight successors by distance …"),
true, &GraphGraphicsView::handleSuccessorDistance);
561 action = preSucMenu->
addAction(
"Highlight path to successor gate …");
562 action->setData(SuccessorGate);
564 action = preSucMenu->
addAction(
"Highlight path to successor module …");
565 action->setData(SuccessorModule);
570 recursionLevelMenu(preSucMenu->
addMenu(
"Add predecessors to view …"),
false, &GraphGraphicsView::handleAddPredecessorToView);
572 recursionLevelMenu(preSucMenu->
addMenu(
"Add common predecessors to view …"),
false, &GraphGraphicsView::handleAddCommonPredecessorToView);
575 action = preSucMenu->
addAction(
"Add path to predecessor gate to view …");
576 action->setData(PredecessorGate);
578 action = preSucMenu->
addAction(
"Add path to predecessor module to view …");
579 action->setData(PredecessorModule);
582 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight predecessors …"),
false, &GraphGraphicsView::handleHighlightPredecessor,
true);
583 recursionLevelMenu(preSucMenu->
addMenu(
"Highlight predecessors by distance …"),
false, &GraphGraphicsView::handlePredecessorDistance);
586 action = preSucMenu->
addAction(
"Highlight path to predecessor gate …");
587 action->setData(PredecessorGate);
589 action = preSucMenu->
addAction(
"Highlight path to predecessor module …");
590 action->setData(PredecessorModule);
595 action = context_menu.addAction(
"Remove selected items from view");
600 action = context_menu.addAction(
"Cancel pick-item mode");
612 if(isGate || isModule)
614 action = context_menu.addAction(
" Fold parent module");
619 action = context_menu.addAction(
" Unfold module");
628 action = context_menu.addAction(
" Fold all parent modules");
630 action = context_menu.addAction(
" Isolate all in new view");
632 action = context_menu.addAction(
" Unfold all selected modules");
635 action = context_menu.addAction(
" Add comment");
637 data.setValue(Node(mItem->
id(), isGate ? Node::NodeType::Gate : Node::NodeType::Module));
644 context_menu.addAction(
"This view:")->setEnabled(
false);
646 action = context_menu.addAction(
" Add module to view");
649 int selectable_modules_count = 0;
650 QSet<u32> not_selectable_modules = getNotSelectableModules();
653 if (!not_selectable_modules.
contains(m->get_id()))
654 selectable_modules_count++;
656 if (selectable_modules_count == 0)
657 action->setDisabled(
true);
659 action = context_menu.addAction(
" Add gate to view");
661 if (getSelectableGates().empty())
662 action->setDisabled(
true);
686 void GraphGraphicsView::handlePluginContextContributionTriggered()
690 ContextMenuContribution* cmc =
static_cast<ContextMenuContribution*
>(act->
data().
value<
void*>());
692 Q_ASSERT(cmc->mContributer);
693 cmc->mContributer->execute_function(cmc->mTagname,
gNetlist,
701 void GraphGraphicsView::updateMatrix(
const int delta)
703 qreal
scale = qPow(2.0, delta / 100.0);
710 void GraphGraphicsView::toggleAntialiasing()
715 bool GraphGraphicsView::itemDraggable(GraphicsItem* item)
723 scale(factor, factor);
733 scale(factor, factor);
737 void GraphGraphicsView::handleCancelPickMode()
742 namespace ShortestPath
755 const Module* parent =
g->get_module();
768 void GraphGraphicsView::handleAddModuleToView()
770 GraphContext* context = mGraphWidget->
getContext();
839 ModuleDialog module_dialog(getNotSelectableModules(),
"Add module to view",
true,
nullptr,
this);
843 module_to_add.
insert(module_dialog.selectedId());
844 ActionAddItemsToObject* act =
new ActionAddItemsToObject(module_to_add, {});
851 QSet<u32> GraphGraphicsView::getNotSelectableModules()
853 GraphContext* context = mGraphWidget->
getContext();
856 QSet<u32> modules_in_context = context->modules();
857 QSet<u32> gates_in_context = context->gates();
861 bool module_in_context =
false;
864 if (modules_in_context.
contains(submodule->get_id()))
866 module_in_context =
true;
872 if (gates_in_context.
contains(subgate->get_id()))
874 module_in_context =
true;
878 if (module_in_context)
884 not_selectable_modules += modules_in_context;
887 for (
u32 id : modules_in_context)
895 if (!cur_module->is_top_module())
897 direct_par_modules.
insert(cur_module->get_parent_module()->get_id());
901 if (!gates_in_context.
empty())
903 for (
u32 id : gates_in_context)
909 for (
u32 id : direct_par_modules)
911 not_selectable_modules.
insert(
id);
914 while (!tmp_module->is_top_module())
916 Module* par_module = tmp_module->get_parent_module();
917 tmp_module = par_module;
918 not_selectable_modules.
insert(par_module->get_id());
922 return not_selectable_modules;
925 QSet<u32> GraphGraphicsView::getSelectableGates()
927 GraphContext* context = mGraphWidget->
getContext();
929 QSet<u32> not_selectable_gates = context->gates();
930 QSet<u32> modules_in_context = context->modules();
932 for (
u32 module_id : modules_in_context)
936 not_selectable_gates.
insert(gate->get_id());
943 if (!not_selectable_gates.
contains(gate->get_id()))
945 selectable_gates.
insert(gate->get_id());
949 return selectable_gates;
952 void GraphGraphicsView::handleAddGateToView()
954 QSet<u32> selectable_gates = getSelectableGates();
956 GraphContext* context = mGraphWidget->
getContext();
958 GateDialog gate_dialog(selectable_gates,
"Add gate to view",
nullptr,
this);
962 gate_to_add.
insert(gate_dialog.selectedId());
963 ActionAddItemsToObject* act =
new ActionAddItemsToObject({}, gate_to_add);
970 void GraphGraphicsView::handleAddSuccessorToView()
975 addSuccessorToView(level,
true);
978 void GraphGraphicsView::handleAddPredecessorToView()
983 addSuccessorToView(level,
false);
986 void GraphGraphicsView::handleAddCommonSuccessorToView()
991 addCommonSuccessorToView(level,
true);
994 void GraphGraphicsView::handleAddCommonPredecessorToView()
999 addCommonSuccessorToView(level,
false);
1002 void GraphGraphicsView::addSuccessorToView(
int maxLevel,
bool succ)
1026 Q_ASSERT(startList.
size());
1028 for (
const Gate*
g : startList)
1032 const NodeBox* box = boxes.
boxForNode(startNode);
1034 int xOrigin = box->x();
1035 int yOrigin = box->y();
1036 int xDir = succ ? 1 : -1;
1040 for (
int loop = 0; !maxLevel || loop<maxLevel; loop++)
1045 for (
const Gate* gOrigin : startList)
1051 if (boxes.boxForGate(
g))
continue;
1056 if (foundList.
isEmpty())
break;
1057 for (
const Gate*
g: foundList)
1060 QPoint point(xOrigin + (loop+1) * xDir, yOrigin +
y);
1061 y =
y > 0 ? -
y : -
y+1;
1063 if (!boxes.boxForPoint(point))
1067 plc.addGridPosition(nd,point);
1070 startList = foundList;
1073 ActionAddItemsToObject* act =
new ActionAddItemsToObject({}, gatsNew);
1075 act->setPlacementHint(plc);
1080 void GraphGraphicsView::addCommonSuccessorToView(
int maxLevel,
bool succ)
1086 for (
const Gate*
g : csp.result())
1088 if (boxes.boxForGate(
g))
continue;
1091 ActionAddItemsToObject* act =
new ActionAddItemsToObject({}, gatsNew);
1096 void GraphGraphicsView::handleHighlightSuccessor()
1104 void GraphGraphicsView::handleHighlightPredecessor()
1112 void GraphGraphicsView::handleSuccessorDistance()
1120 void GraphGraphicsView::handlePredecessorDistance()
1128 void GraphGraphicsView::handleShortestPathToView()
1134 bool succ = (param == SuccessorModule || param == SuccessorGate);
1135 bool isMod = (param == SuccessorModule || param == PredecessorModule);
1136 std::vector<Gate*> spath;
1138 Q_ASSERT(startGate);
1143 const Module* parMod = startGate->get_module();
1146 excludeModules.
insert(parMod->get_id());
1147 parMod = parMod->get_parent_module();
1150 ModuleDialog md(excludeModules,
"Shortest path to module",
true,
nullptr,
this);
1155 Q_ASSERT(endModule);
1165 selectableGates.
insert(
g->get_id());
1169 GateDialog gd(selectableGates,
QString(
"Shortest path %1 gate").arg(succ?
"to":
"from"),
nullptr,
this);
1183 if (spath.empty())
return;
1184 if (!succ) std::reverse(spath.begin(), spath.end());
1187 const NodeBox* originBox = boxes.
boxForGate(startGate);
1188 Q_ASSERT(originBox);
1189 QPoint point(originBox->x(),originBox->y());
1190 QPoint deltaX(succ ? 1 : -1, 0);
1195 for (Gate*
g : spath)
1197 if (boxes.boxForGate(
g))
continue;
1200 }
while (boxes.boxForPoint(point));
1205 plc.addGridPosition(nd,point);
1208 ActionAddItemsToObject* act =
new ActionAddItemsToObject({},gats);
1210 act->setPlacementHint(plc);
1214 void GraphGraphicsView::handleQueryShortestPathModule()
1218 bool succ = send->
data().
toInt() == SuccessorGate;
1223 Module* par =
g->get_module();
1226 excludeModules.
insert(par->get_id());
1227 par = par->get_parent_module();
1229 ModuleDialog md(excludeModules,
"Shortest path to module",
true,
nullptr,
this);
1236 void GraphGraphicsView::handleQueryShortestPathGate()
1240 bool succ = send->
data().
toInt() == SuccessorGate;
1244 selectableGates.
insert(
g->get_id());
1246 GraphGraphicsViewNeighborSelector* ggvns =
new GraphGraphicsViewNeighborSelector(mItem->
id(), succ,
this);
1247 GateDialog gd(selectableGates,
QString(
"Shortest path %1 gate").arg(succ?
"to":
"from"),ggvns,
this);
1251 u32 targetId = gd.selectedId();
1252 if (!targetId)
return;
1262 std::vector<Gate*> spath;
1266 Q_ASSERT(!nodeTo.
isNull());
1274 spath = forwardDirection ?
1292 Gate* previousGate =
nullptr;
1293 for (
Gate*
g : spath)
1309 QString(
"Path from '%1'[%2] to %3")
1317 void GraphGraphicsView::handleSelectOutputs()
1327 for (
auto net : gate->get_fan_out_nets())
1329 for (
const auto& suc :
net->get_destinations())
1332 for (
const auto&
id : context->modules())
1335 if (m->contains_gate(suc->get_gate(),
true))
1343 gates.
insert(suc->get_gate()->get_id());
1353 for (
const auto& suc :
net->get_destinations())
1356 for (
const auto&
id : context->modules())
1359 if (m->contains_gate(suc->get_gate(),
true))
1367 gates.
insert(suc->get_gate()->get_id());
1373 gates = context->getLayouter()->boxes().filterNotInView(gates);
1374 ActionAddItemsToObject* act =
new ActionAddItemsToObject({},gates);
1386 void GraphGraphicsView::handleSelectInputs()
1396 for (
auto net : gate->get_fan_in_nets())
1398 if (!
net->get_sources().empty() &&
net->get_sources().at(0)->get_gate() !=
nullptr)
1401 for (
const auto&
id : context->modules())
1404 if (m->contains_gate(
net->get_sources().at(0)->get_gate(),
true))
1412 gates.
insert(
net->get_sources().at(0)->get_gate()->get_id());
1422 if (!
net->get_sources().empty() &&
net->get_sources().at(0)->get_gate() !=
nullptr)
1425 for (
const auto&
id : context->modules())
1428 if (m->contains_gate(
net->get_sources().at(0)->get_gate(),
true))
1436 gates.
insert(
net->get_sources().at(0)->get_gate()->get_id());
1442 gates = context->getLayouter()->boxes().filterNotInView(gates);
1443 ActionAddItemsToObject* act =
new ActionAddItemsToObject({},gates);
1456 void GraphGraphicsView::selectedNodeToItem()
1459 NodeBox* box =
nullptr;
1471 mItem = box->item();
1476 selectedNodeToItem();
1478 handleFoldParentSingle();
1483 selectedNodeToItem();
1485 handleUnfoldSingleAction();
1488 void GraphGraphicsView::handleFoldParentSingle()
1490 const Module* parentModule =
nullptr;
1492 u32 id = mItem->
id();
1514 ActionFoldModule* act =
new ActionFoldModule(parentModule->
get_id());
1515 act->setContextId(context->
id());
1516 act->setPlacementHint(plc);
1520 void GraphGraphicsView::handleUnfoldSingleAction()
1522 GraphContext* context = mGraphWidget->
getContext();
1524 if (m->get_gates().empty() && m->get_submodules().empty())
1527 msg.
setText(
"This module is empty.\nYou can't unfold it.");
1534 ActionUnfoldModule* act =
new ActionUnfoldModule(mItem->
id());
1535 act->setContextId(context->id());
1539 void GraphGraphicsView::handleFoldParentAll()
1541 GraphContext* context = mGraphWidget->
getContext();
1547 if (!context->getLayouter()->boxes().boxForNode(nd))
continue;
1562 for (
const Module* m : modSet)
1563 if (m) modDepth.
insertMulti(m->get_submodule_depth(),m);
1567 while (it.hasPrevious())
1570 const Module* m = it.value();
1571 ActionFoldModule* act =
new ActionFoldModule(m->get_id());
1572 act->setContextId(context->id());
1577 void GraphGraphicsView::handleUnfoldAllAction()
1582 UserActionCompound* act =
new UserActionCompound;
1585 ActionUnfoldModule* ufo =
new ActionUnfoldModule(
id);
1586 ufo->setContextId(context->id());
1587 act->addAction(ufo);
1590 context->endChange();
1593 #ifdef GUI_DEBUG_GRID
1594 void GraphGraphicsView::debugShowLayouterGridpos(
const QPoint& mouse_pos)
1600 const GraphLayouter* layouter = context->
getLayouter();
1601 if (!(layouter->done()))
1605 QPoint layouter_pos = closestLayouterPos(scene_mouse_pos).first;
1606 m_debug_gridpos = layouter_pos;
1615 const GraphLayouter* layouter = context->getLayouter();
1616 assert(layouter->done());
1618 int default_width = layouter->defaultGridWidth();
1619 int default_height = layouter->defaultGridHeight();
1620 int min_x = layouter->minXIndex();
1621 int min_y = layouter->minYIndex();
1624 LayouterPoint x_point = closestLayouterPoint(scene_pos.
x(), default_width, min_x, x_vals);
1625 LayouterPoint y_point = closestLayouterPoint(scene_pos.
y(), default_height, min_y, y_vals);
1626 return qMakePair(
QPoint(x_point.mIndex, y_point.mIndex),
QPointF(x_point.mPos, y_point.mPos));
1629 GraphGraphicsView::LayouterPoint GraphGraphicsView::closestLayouterPoint(qreal scene_pos,
int default_spacing,
int min_index,
QVector<qreal> sections)
const
1631 int index = min_index;
1633 if (sections.
first() > scene_pos)
1635 int distance = sections.
first() - scene_pos;
1636 int nSections = distance / default_spacing;
1637 index -= (nSections + 1);
1638 pos = sections.
first() + index * default_spacing;
1640 else if (sections.
last() <= scene_pos)
1642 int distance = scene_pos - sections.
last();
1643 int nSections = distance / default_spacing;
1644 index += (sections.
size() + nSections -1);
1645 pos = sections.
last() + nSections * default_spacing;
1654 if (scene_pos < *jt)
break;
1661 return LayouterPoint{index,
pos};
1677 return mDragModifier;
1687 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