void CopyFilterGUIChannelItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { if (currentConnection == NULL) { if (!boundingRect().contains(event->pos())) { currentConnection = new CopyFilterGUIConnectionItem(); scene()->addItem(currentConnection); } } if (currentConnection != NULL) { CopyFilterGUIChannelItem* item = findAt(event->scenePos()); if (item == NULL) { QLineF line; if (output) line = QLineF(event->scenePos(), getPerimeterPointTo(event->scenePos())); else line = QLineF(getPerimeterPointTo(event->scenePos()), event->scenePos()); currentConnection->setLine(line); } else { currentConnection->setLine(getLineTo(item)); } } }
BinaryNode<T>* BinarySearchTree<T>::findAt(BinaryNode<T> * node, const T& anItem) const // Retrieves an item starting searching at node { if (node == NULL) { // Then the item was not found return NULL; } else if (anItem == node->item) { // Then found return node; } else if (anItem < node->item) { // Search in the left tree return (findAt(node->leftChild, anItem)); } else { // Search in the right tree return (findAt(node->rightChild, anItem)); } }
void CopyFilterGUIChannelItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { if (currentConnection != NULL) { CopyFilterGUIChannelItem* item = findAt(event->scenePos()); if (item != NULL) { CopyFilterGUIChannelItem* source; CopyFilterGUIChannelItem* target; if (output) { source = item; target = this; } else { source = this; target = item; } double factor = 1.0; if (source->getName() == "") factor = 0.0; scene()->addItem(new CopyFilterGUIConnectionItem(source, target, factor, false)); emit((CopyFilterGUIScene*)scene())->updateModel(); emit((CopyFilterGUIScene*)scene())->updateChannels(); } scene()->removeItem(currentConnection); delete currentConnection; currentConnection = NULL; } else { scene()->clearSelection(); QList<QGraphicsItem*> items = scene()->items(); for (QGraphicsItem* item : items) { CopyFilterGUIConnectionItem* connItem = qgraphicsitem_cast<CopyFilterGUIConnectionItem*>(item); if (connItem != NULL) { if (connItem->getSource() == this || connItem->getTarget() == this) connItem->setSelected(true); } } } }
void CFotoEntity::FindAt( int nX, int nY ){ m_nColor = getPixel(nX, nY); findAt(nX, nY); }
BinaryNode<T>* BinarySearchTree<T>::find(const T& anItem) const // Retrieves the node corresponding to the item. If not found, returns null { return (findAt(BinaryTree<T>::root, anItem)); }