本文整理汇总了C++中Port::disconnectAll方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::disconnectAll方法的具体用法?C++ Port::disconnectAll怎么用?C++ Port::disconnectAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port::disconnectAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menu
// Called when not in connection mode
void
FlowDesigner::handleNormalClick(QMouseEvent *event) {
float x = event->x();
float y = event->y();
Component *comp = getComponentIntersection(x, y);
Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
if (comp != NULL) {
Port *port = getPortIntersection(comp, x, y);
if (port) {
if (event->button() == Qt::RightButton) {
// Show context menu
QMenu menu(this);
port->createContextMenu(&menu);
QAction *selected = menu.exec(mapToGlobal(QPoint(x, y)));
if (selected != NULL) {
port->handleContextSelect(selected);
}
} if (event->button() == Qt::MiddleButton ||
modifiers.testFlag(Qt::ControlModifier)) {
m_project->clearSelected();
port->disconnectAll();
} else {
m_project->clearSelected();
// We've clicked on an output
// Start a new connection
m_connectingPort = port;
updateConnectionCoords(event);
}
repaint();
} else if (event->button() == Qt::LeftButton) { // Do selecting/dragging
if (!modifiers.testFlag(Qt::ControlModifier) &&
!m_project->isSelected(comp)) m_project->clearSelected();
m_project->addSelected(comp);
// Assume we're dragging
// If not, when the release comes
// dragging will be set to false
m_dragging = true;
repaint();
} else if (event->button() == Qt::RightButton) {
if (!modifiers.testFlag(Qt::ControlModifier) &&
!m_project->isSelected(comp)) m_project->clearSelected();
m_project->addSelected(comp);
// We've right-clicked on the body of the component
// Pop up a context window
QMenu menu(this);
comp->createContextMenu(&menu);
menu.addSeparator();
QAction *d = menu.addAction("Delete");
QAction *selected = menu.exec(mapToGlobal(QPoint(x, y)));
if (selected == d) {
m_project->deleteSelected();
repaint();
} else if (selected != NULL) {
comp->handleContextSelect(selected);
}
}
} else {
if (!modifiers.testFlag(Qt::ControlModifier)) m_project->clearSelected();
repaint();
}
}