Exemplo n.º 1
0
Q3CanvasRectangle *decoratePoint(const QPoint& p)
{
    const int SIZE = 4;
    UMLView *currentView = UMLApp::app()->currentView();
    Q3CanvasRectangle *rect;
    rect = new Q3CanvasRectangle(p.x() - SIZE / 2,
                                 p.y() - SIZE / 2,
                                 SIZE, SIZE, currentView->canvas());
    rect->setBrush( QBrush(Qt::blue) );
    rect->setPen( QPen(Qt::blue) );
    rect->setVisible(true);
    return rect;
}
Exemplo n.º 2
0
void DigitView::removeHandles()
{
  Q3PtrListIterator<Q3CanvasRectangle> itr(m_handles);
  Q3CanvasRectangle* handle;
  while ((handle = itr.current()) != 0)
  {
    ASSERT_ENGAUGE(handle != 0);
    QRect bounds = handle->boundingRect();

    m_handles.remove(handle); // autoDelete is on

    update(0, bounds);
  }
}
Exemplo n.º 3
0
void DigitView::moveHandles(QPoint delta)
{
  Q3PtrListIterator<Q3CanvasRectangle> itr(m_handles);
  Q3CanvasRectangle* handle;
  while ((handle = itr.current()) != 0)
  {
    ASSERT_ENGAUGE(handle != 0);
    QRect rectOld = handle->boundingRect();

    handle->moveBy((double) delta.x(), (double) delta.y());

    update(0, rectOld);
    update(0, handle->boundingRect());

    ++itr;
  }
}
Exemplo n.º 4
0
void DigitView::addHandles(const QRect &bounds)
{
  m_handles.clear();

  // show eight handles that represent the bounding rectangle for the selected items. we
  // do not put handles on each point since the points can be too small to fit the
  // handles, and also that would be slower
  for (int i = 0; i < 9; i++)
  {
    QSize handleSize = DefaultSettings::instance().getHandleSize();
    int handleWidth = handleSize.width();
    int handleHeight = handleSize.height();
    
    // looping clockwise starting at top right point
    int x, y;
    if (i < 3)
      x = bounds.left() + bounds.width();
    else if ((i == 3) || (i == 7))
      x = bounds.left() + (bounds.width() + 1) / 2 - handleWidth / 2;
    else
      x = bounds.left() - handleWidth;
    if ((1 < i) && (i < 5))
      y = bounds.top() + bounds.height();
    else if ((i == 1) || (i == 5))
      y = bounds.top() + (bounds.height() + 1) / 2 - handleHeight / 2;
    else
      y = bounds.top() - handleHeight;
    ASSERT_ENGAUGE(document() != 0);
    Q3CanvasRectangle* handle = new Q3CanvasRectangle(x, y, handleWidth, handleHeight, document()->canvas());
    CHECK_PTR_ENGAUGE(handle);
    handle->setBrush(QBrush(Qt::green));
    handle->setPen(QPen(Qt::black, 1));
    handle->setZ(ZHandles);
    handle->show();

    update(0, handle->boundingRect());

    m_handles.append(handle);
  }
}