ScreenGrabberChooserRectItem::ScreenGrabberChooserRectItem(QGraphicsScene* scene) { scene->addItem(this); setCursor(QCursor(Qt::OpenHandCursor)); this->mainRect = createHandleItem(scene); this->topLeft = createHandleItem(scene); this->topCenter = createHandleItem(scene); this->topRight = createHandleItem(scene); this->rightCenter = createHandleItem(scene); this->bottomRight = createHandleItem(scene); this->bottomCenter = createHandleItem(scene); this->bottomLeft = createHandleItem(scene); this->leftCenter = createHandleItem(scene); this->topLeft->setCursor(QCursor(Qt::SizeFDiagCursor)); this->bottomRight->setCursor(QCursor(Qt::SizeFDiagCursor)); this->topRight->setCursor(QCursor(Qt::SizeBDiagCursor)); this->bottomLeft->setCursor(QCursor(Qt::SizeBDiagCursor)); this->leftCenter->setCursor(QCursor(Qt::SizeHorCursor)); this->rightCenter->setCursor(QCursor(Qt::SizeHorCursor)); this->topCenter->setCursor(QCursor(Qt::SizeVerCursor)); this->bottomCenter->setCursor(QCursor(Qt::SizeVerCursor)); this->mainRect->setRect(QRect()); hideHandles(); }
void ScreenGrabberChooserRectItem::beginResize(QPointF mousePos) { rectWidth = this->rectHeight = 0; mainRect->setRect(QRect()); state = Resizing; startPos = mousePos; setCursor(QCursor(Qt::CrossCursor)); hideHandles(); mainRect->grabMouse(); }
AbstractGraphicsRectItem::AbstractGraphicsRectItem(QAbstractGraphicsShapeItem *shapeItem, QGraphicsItem *parent) : KaptionGraphicsItem(shapeItem, parent), m_hTL(new HandleGraphicsItem(0, shapeItem)), m_hTR(new HandleGraphicsItem(0, shapeItem)), m_hBL(new HandleGraphicsItem(0, shapeItem)), m_hBR(new HandleGraphicsItem(0, shapeItem)), m_startingPoint(0) { connect(m_hTL, SIGNAL(moved(QPointF)), this, SLOT(updateTopLeft(QPointF))); connect(m_hTR, SIGNAL(moved(QPointF)), this, SLOT(updateTopRight(QPointF))); connect(m_hBL, SIGNAL(moved(QPointF)), this, SLOT(updateBottomLeft(QPointF))); connect(m_hBR, SIGNAL(moved(QPointF)), this, SLOT(updateBottomRight(QPointF))); m_handles << m_hTL << m_hTR << m_hBL << m_hBR; hideHandles(); dropShadowEffect()->setOffset(dropShadowEffect()->offset() - QPoint(5, 5)); }