Exemple #1
0
void TabbedPane::processMouse(const scv::MouseEvent &evt) {
   static Kernel *kernel = Kernel::getInstance();

   if (isDragging() || isResizing()) {
      Component::processMouse(evt);
      if (getCurrTabIndex() != -1 && isResizing()) {
         configPanel();
      }
   } else {

      if (getCurrTabIndex() == -1 || !_receivingCallbacks) {
         Component::processMouse(evt);
         return;
      } else if(getCurrTabIndex() != -1) {
         getChild(getCurrTabIndex())->setDraggable(false);
         getChild(getCurrTabIndex())->processMouse(evt);
      }

      Component::processMouse(evt);

      Point currPosition = getAbsolutePosition();
      Point relativeMouse = evt.getPosition();

      if (evt.getState() == MouseEvent::UP) configPanel();

      // open menu
      if (isInside(evt.getPosition())) {
         _currecOverTab = -1;
         if (kernel->requestMouseUse(this)) {
            // over menu
            for (int i = 0; i < _children.size(); i++) {
               if (relativeMouse.x > _index[i] + currPosition.x && relativeMouse.x < _index[i + 1] + currPosition.x - 1
                  && relativeMouse.y > currPosition.y && relativeMouse.y < currPosition.y + s_barHeight) {
                     if (getCurrTabIndex() != i) _currecOverTab = i;
                     break;
               }
            }
            if (isFocused()) {
               if (evt.getState() == MouseEvent::CLICK && evt.getButton() == MouseEvent::LEFT) {
                  for (int i = 0; i < _children.size(); i++) {
                     if (relativeMouse.x > _index[i] + currPosition.x && relativeMouse.x < _index[i + 1] + currPosition.x - 1
                        && relativeMouse.y > currPosition.y && relativeMouse.y < currPosition.y + s_barHeight) {
                           setCurrTabIndex(i);
                           _currecOverTab   = -1;
                           configPanel();
                           break;
                     }
                  }
               }
            }
         }
      } else {
         _currecOverTab = -1;
      }
   }
}
Exemple #2
0
void Selection::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
    if(isReadOnly())
        return;

    QPointF move_delta = event->pos() - event->lastPos();

    if(isResizing())
        resizeBy(move_delta);
    else
        moveBy(move_delta);

    event->accept();
}