void MultiContainerWidget::updateCursorRecursively() { QList<RegExpWidget *>::const_iterator it = _children.constBegin(); for ( ; it != _children.constEnd() ; ++it ) { (*it)->updateCursorRecursively(); } updateCursorShape(); }
void NcWidgetData::handleMouseMoveEvent( QMouseEvent* event ) { if ( mLeftButtonPressed ) { if ( d->mWidgetResizable && mPressedMousePos.onEdges ) { resizeWidget( event->globalPos() ); } else if ( d->mWidgetMovable ) { moveWidget( event->globalPos() ); } } else if ( d->mWidgetResizable ) { updateCursorShape( event->globalPos() ); } }
void FrameLess::mouseMove(QMouseEvent *e) { if (_leftButtonPressed) { if (_mousePress != None) { int left = _rubberband->frameGeometry().left(); int top = _rubberband->frameGeometry().top(); int right = _rubberband->frameGeometry().right(); int bottom = _rubberband->frameGeometry().bottom(); if (_mousePress == Top) { top = e->globalPos().y(); } else if (_mousePress == Bottom) { bottom = e->globalPos().y(); } else if (_mousePress == Left) { left = e->globalPos().x(); } else if (_mousePress == Right) { right = e->globalPos().x(); } else if (_mousePress == TopLeft) { top = e->globalPos().y(); left = e->globalPos().x(); } else if (_mousePress == TopRight) { right = e->globalPos().x(); top = e->globalPos().y(); } else if (_mousePress == BottomLeft) { bottom = e->globalPos().y(); left = e->globalPos().x(); } else if (_mousePress == BottomRight) { bottom = e->globalPos().y(); right = e->globalPos().x(); } QRect newRect(QPoint(left, top), QPoint(right, bottom)); if (newRect.width() < _parent->minimumWidth()) { left = _parent->frameGeometry().x(); } else if (newRect.height() < _parent->minimumHeight()) { top = _parent->frameGeometry().y(); } _parent->setGeometry(QRect(QPoint(left, top), QPoint(right, bottom))); _rubberband->setGeometry(QRect(QPoint(left, top), QPoint(right, bottom))); } } else { updateCursorShape(e->globalPos()); } }
void OverlayEditorScene::mousePressEvent(QGraphicsSceneMouseEvent *e) { QGraphicsScene::mousePressEvent(e); if (e->isAccepted()) return; if (e->button() == Qt::LeftButton) { e->accept(); if (wfsHover == Qt::NoSection) { qgpiSelected = childAt(e->scenePos()); if (qgpiSelected) { qgriSelected->setRect(selectedRect()); qgriSelected->show(); } else { qgriSelected->hide(); } } updateCursorShape(e->scenePos()); } }
void RegExpWidget::updateCursorRecursively() { updateCursorShape(); }
void RegExpWidget::enterEvent( TQEvent * ) { updateCursorShape(); }
void FrameLess::mouseHover(QHoverEvent *e) { updateCursorShape(_parent->mapToGlobal(e->pos())); }
void OverlayEditorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { QGraphicsScene::mouseMoveEvent(e); if (e->isAccepted()) return; if (qgpiSelected && (e->buttons() & Qt::LeftButton)) { e->accept(); if (wfsHover == Qt::NoSection) return; QPointF delta = e->scenePos() - e->buttonDownScenePos(Qt::LeftButton); bool square = e->modifiers() & Qt::ShiftModifier; QRectF orig = selectedRect(); switch (wfsHover) { case Qt::TitleBarArea: orig.translate(delta); break; case Qt::TopSection: orig.setTop(orig.top() + delta.y()); if (orig.height() < 8.0f) orig.setTop(orig.bottom() - 8.0f); if (square) orig.setRight(orig.left() + orig.height()); break; case Qt::BottomSection: orig.setBottom(orig.bottom() + delta.y()); if (orig.height() < 8.0f) orig.setBottom(orig.top() + 8.0f); if (square) orig.setRight(orig.left() + orig.height()); break; case Qt::LeftSection: orig.setLeft(orig.left() + delta.x()); if (orig.width() < 8.0f) orig.setLeft(orig.right() - 8.0f); if (square) orig.setBottom(orig.top() + orig.width()); break; case Qt::RightSection: orig.setRight(orig.right() + delta.x()); if (orig.width() < 8.0f) orig.setRight(orig.left() + 8.0f); if (square) orig.setBottom(orig.top() + orig.width()); break; case Qt::TopLeftSection: orig.setTopLeft(orig.topLeft() + delta); if (orig.height() < 8.0f) orig.setTop(orig.bottom() - 8.0f); if (orig.width() < 8.0f) orig.setLeft(orig.right() - 8.0f); if (square) { qreal size = qMin(orig.width(), orig.height()); QPointF sz(-size, -size); orig.setTopLeft(orig.bottomRight() + sz); } break; case Qt::TopRightSection: orig.setTopRight(orig.topRight() + delta); if (orig.height() < 8.0f) orig.setTop(orig.bottom() - 8.0f); if (orig.width() < 8.0f) orig.setRight(orig.left() + 8.0f); if (square) { qreal size = qMin(orig.width(), orig.height()); QPointF sz(size, -size); orig.setTopRight(orig.bottomLeft() + sz); } break; case Qt::BottomLeftSection: orig.setBottomLeft(orig.bottomLeft() + delta); if (orig.height() < 8.0f) orig.setBottom(orig.top() + 8.0f); if (orig.width() < 8.0f) orig.setLeft(orig.right() - 8.0f); if (square) { qreal size = qMin(orig.width(), orig.height()); QPointF sz(-size, size); orig.setBottomLeft(orig.topRight() + sz); } break; case Qt::BottomRightSection: orig.setBottomRight(orig.bottomRight() + delta); if (orig.height() < 8.0f) orig.setBottom(orig.top() + 8.0f); if (orig.width() < 8.0f) orig.setRight(orig.left() + 8.0f); if (square) { qreal size = qMin(orig.width(), orig.height()); QPointF sz(size, size); orig.setBottomRight(orig.topLeft() + sz); } break; case Qt::NoSection: // Handled above, but this makes the compiler happy. return; } qgriSelected->setRect(orig); } else { updateCursorShape(e->scenePos()); } }
void NcWidgetData::handleHoverMoveEvent( QHoverEvent* event ) { if ( d->mWidgetResizable ) updateCursorShape( mWidget->mapToGlobal( event->pos() ) ); }