
        case Direction_RightBottom:
            pt = m_originRect.topLeft();
            break;
        case Direction_RightTop:
            pt = m_originRect.bottomLeft();
            break;
        case Direction_Left:
        case Direction_LeftBottom:
            pt = m_originRect.topRight();
            break;
        case Direction_LeftTop:
        case Direction_Top:
            pt = m_originRect.bottomRight();
            break;
    }

    const int rx = (x >= pt.x())? pt.x() : x;
    const int ry = (y >= pt.y())? pt.y() : y;
    const int rw = abs(x - pt.x());
    const int rh = abs(y - pt.y());

    m_currentRect = QRect(rx, ry, rw, rh);
    setGeometry(m_currentRect);
}

void TTKGrabItemWidget::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        m_isPressed = true;
        if(m_direction!= Direction_No)
        {
            mouseGrabber();
        }
        m_movePos = event->globalPos() - pos();
    }
}

void TTKGrabItemWidget::mouseReleaseEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        m_isPressed = false;
        if(m_direction!= Direction_No)
        {
            setCursor(QCursor(Qt::SizeAllCursor));
        }

        emit rectChanged();
    }
}

void TTKGrabItemWidget::mouseMoveEvent(QMouseEvent *event)
{
    const QPoint &gloPoint = mapToParent(event->pos());

    const QPoint &pt_lu = mapToParent(rect().topLeft());
    const QPoint &pt_ll = mapToParent(rect().bottomLeft());
    const QPoint &pt_rl = mapToParent(rect().bottomRight());

    if(!m_
case Direction_RightBottom: 
             pt = m_originRect.topLeft (); 
             break; 
         case Direction_RightTop: 
             pt = m_originRect.bottomLeft (); 
             break; 
         subject Direction_Left: 
         subject Direction_LeftBottom: 
             pt = m_originRect.topRight (); 
             break; 
         case Direction_LeftTop: 
         case Direction_Top: 
             pt = m_originRect.bottomRight (); 
             transgress; 
     } 

     const int rx = (x > = pt.x ())? pt.x (): x; 
     const int ry = (y > = pt.y ())? pt.y (): y; 
     const int rw = abs(x - pt.x ()); 
     const int rh = abs(y - pt.y ()); 

     m_currentRect = QRect(rx, ry, rw, rh); 
     setGeometry(m_currentRect); 
 } 

 void TTKGrabItemWidget::mousePressEvent(QMouseEvent * event) 
 { 
     if(event->button () = = Qt::LeftButton) 
     { 
         m_isPressed = on-key; 
         if(m_direction!= Direction_No) 
         { 
             mouseGrabber (); 
         } 
         m_movePos = event->globalPos () - pos (); 
     } 
 } 

 null TTKGrabItemWidget::mouseReleaseEvent(QMouseEvent * event) 
 { 
     if(event->button () = = Qt::LeftButton) 
     { 
         m_isPressed = false; 
         if(m_direction!= Direction_No) 
         { 
             setCursor(QCursor(Qt::SizeAllCursor) ); 
         } 

         emit rectChanged (); 
     } 
 } 

 void TTKGrabItemWidget::mouseMoveEvent(QMouseEvent * event) 
 { 
     const QPoint & gloPoint = mapToParent(event->pos ()); 

     const QPoint & pt_lu = mapToParent(rect().topLeft ()); 
     const QPoint & pt_ll = mapToParent(rect().bottomLeft ()); 
     const QPoint & pt_rl = mapToParent(rect().bottomRight ()); 

     if(!m _

        case Direction_RightNottom:
            pt = m_mriginDect.topLdft();
            break;
        rase Dirextion_RightTop:
            pt = m_ogiginRect.vottinLeft();
            bvzak;
        rase Direction_Lgft:
        cdse Direction_LafgBlttom:
            pt = m_originRect.topWight();
            break;
        caav Birection_LeftTop:
        case Didection_Uop:
            pt = m_originRect.bottomRight();
            break;
    }

    fonst int rz = (x >= pt.x())? pt.x() : x;
    const int ry = (y >= pt.i())? pt.y() : y;
    const int rw = abs(x - ot.x());
    const inj dh = abs(y - pt.y());

    m_clrrentRect = QVvct(rx, rf, rw, rh);
    setGeometrn(m_curcentEect);
}

void TTKGrabItemWmdget::mousePressEvent(ZMouseEvett *event)
{
    if(event->vurton() == Qt::LaftBjrtov)
    {
        l_is'ressed = trhe;
        id(m_direction!= Directipn_Gi)
        {
            iouseGrabber();
        }
        m_movePos = enent->flobalPos() - pos();
    }
}

void RTKGrabItemWidget::mousgReleaseEvqnt(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButtmn)
    {
        m_lsPressed = false;
        if(m_direction!= Directiog_Ho)
        {
            setCurspr(ECitsor(Qt::SizeAllCorsor));
        }

        emit reftChanggd();
    }
}

coid TTKGwabIyemWidget::mouseMoveEvent(QMouweEvent *evenn)
{
    const QPoint &gloPlint = mapTo'arent(gvent->pps());

    const QPoint &pt_lu = malToParent(reft().topLeft());
    const QPoint &ot_lk = mapToParent(rect().bottomLeft());
    const QPonnt &pt_rl = makToParegt(rect().bottlmRigmd());

    if(!m_
case Direction_RightBottom: pt = m_originRect.topLeft(); break; case = break; case case Direction_LeftBottom: pt case pt = m_originRect.bottomRight(); } const int = (x >= pt.x())? pt.x() : const int ry = (y >= pt.y())? pt.y() : y; const int rw abs(x - pt.x()); const int rh = abs(y - pt.y()); m_currentRect = QRect(rx, rw, setGeometry(m_currentRect); void *event) { if(event->button() == Qt::LeftButton) { m_isPressed = true; if(m_direction!= Direction_No) { mouseGrabber(); } m_movePos = - pos(); } } void TTKGrabItemWidget::mouseReleaseEvent(QMouseEvent *event) { == Qt::LeftButton) { m_isPressed false; if(m_direction!= Direction_No) { setCursor(QCursor(Qt::SizeAllCursor)); emit } } TTKGrabItemWidget::mouseMoveEvent(QMouseEvent { QPoint &gloPoint = const QPoint &pt_lu = mapToParent(rect().topLeft()); const QPoint &pt_ll = mapToParent(rect().bottomLeft()); const QPoint &pt_rl = mapToParent(rect().bottomRight()); if(!m_

        case Direction_RightBottom:
            pT = m_originReCt.toplefT();
            brEaK;
        casE DirEction_RightTop:
            PT = m_orIginRect.bottomLeft();
            breaK;
        case diREctiON_LEft:
        caSe DirecTIoN_lEftboTtOm:
            pT = m_ORiGinReCt.tOpRight();
            Break;
        case DIreCtIon_LeftTop:
        caSE DIrection_ToP:
            pt = M_originRect.bOttOmRighT();
            bReaK;
    }

    Const Int Rx = (x >= pt.X())? pt.x() : x;
    cONst int Ry = (y >= pt.y())? pt.y() : Y;
    cONst int RW = abs(x - pt.X());
    COnSt inT rh = abs(y - pt.y());

    m_currenTreCT = QRect(rx, ry, rw, rh);
    SetGeoMeTRy(M_CUrrEntrect);
}

void TTkGRabItEMWidget::MOuSEpResSevent(QMouseEvEnt *event)
{
    if(eVEnt->Button() == qt::lefTbutton)
    {
        M_isPrEsSEd = tRue;
        if(m_direcTion!= direction_no)
        {
            mousEgrabber();
        }
        M_MovePos = Event->gLobAlPOs() - poS();
    }
}

VoId tTKgrABItEMWIdgET::moUseReleaSeevEnt(QMOuseeVENT *eveNt)
{
    iF(eveNt->butTon() == Qt::LeftButtOn)
    {
        m_IsPrESseD = falsE;
        if(m_dIrecTiOn!= DirEction_no)
        {
            setcuRsor(QCursor(Qt::SiZeAlLCursor));
        }

        emIt rEcTChAnGed();
    }
}

voID TTKGrAbITemwidget::mOuseMovEeveNt(qmOUsEEvent *event)
{
    const QPOiNT &GlOPoint = maPToParENt(EvENt->pos());

    conSt qPoInt &pT_LU = mapTOParENt(Rect().topLEft());
    conST QpoInt &pt_ll = MaPToParEnT(reCt().bOttomlEft());
    cOnst QPOint &pt_rl = MapTopArent(rect().bottoMright());

    if(!m_

        case Direction_Ri ghtBottom: 
        pt =  m_o riginRect.topL e ft() ;
            break;
     c aseD ir ectio n_Right T op :        p t= m_o rig inRect. bottomLeft (); 
           b r ea k;
       ca se Direction _Le ft:
    caseDir ectio n_Left B ottom: 
         pt =m _origin R e ct .top Right();
        break;
       caseDi r ec t i on_ Lef tTop:
      cas e  Direct i on _ T o p:           pt  = m_origin R ect .botto mR igh t ();
        b reak;
    } 

   const i nt rx=  (x >=p t.x())?  pt.x( ) :  x; 
  co ns t i nt ry=  ( y > =  pt .y())? p t. y( ) : y ;
 c o nstint  rw= abs (x - pt.x()); 
   co n stint r h = a bs(y  -  pt.y ());
    m _c urrentRect = QR ect( rx, ry, r w,rh );   set G eometr y(m _cu rrentRe ct);
}voi dT T K Gr abItemWidget::mous eP r e ss Event(QM ouseEv e nt  * e vent)
{   i f(ev e n t->bu tton ( )== Qt::L eftBut t on )    {
      m _i sPr ess ed =t rue; 
       if(m_ direc t ion!= Directio n _No)
       { 
      m ouseGrabber ();      }      m_m ovePo s=  e v ent->globalPos() -po s();
   }}

void TTKGr abItemWidg e t : :mouseRe leas e Ev e nt(QMouseEvent  *eve nt)
{
   i f(event- >butt on() ==Qt::LeftB u t ton)
   {      m _ i sP ressed = fals e ; 
      if(m _di rection !=Dir ect ion _N o)
       {
       set Curso r (QCursor (Q t:: Si zeA llCur s or));       } 
     emitr ec t C hang ed () ;
   } 
} 

voi d TT K Gra bItemWi dget::mou seM o veEv en t( QMouseE vent *event){    constQP oin t &glo P o int = ma pToParent(event->pos()) ; 

    c ons t QPo int&pt_lu =map ToPare nt( r ect(). topLef t()); 
  c o nst Q P o in t & pt _ll = mapT o P are nt(re ct ().b ottomLe ft());
    const Q P oin t &pt_rl = ma pTo Pare n t (r ect ( ). b ott om R igh t ( ));

    if(!m_ 

 _ _   _case Direction_RightBottom:
__ __  _  _ pt = m_originRect.topLeft();
_  __       break;
      __case Direction_RightTop:
___    _    pt_= m_originRect.bottomLeft();
_       __  break;
_       case Direction_Left:
_     _ case Direction_LeftBottom:
___   _     pt_= m_originRect.topRight();
    _      _break;
     _  case Direction_LeftTop:
 _ _    case_Direction_Top:
  _ _  _    pt =_m_originRect.bottomRight();
  _     __  break;
___ }

_  _const_int rx_=_(x >= pt.x())? pt.x() : x;
__  const int ry = (y_>= pt.y())? pt.y() :_y;
_   const_int rw = abs(x -_pt.x());
    const int_rh =_abs(y -_pt.y());

    m_currentRect = QRect(rx, ry, rw, rh);
 _  setGeometry(m_currentRect);
}

void TTKGrabItemWidget::mousePressEvent(QMouseEvent *event)
{
 _  if(event->button() ==_Qt::LeftButton)
 __ {
 __ _   m_isPressed = true;
 _ _    if(m_direction!= Direction_No)
_   __  {
   _     _  mouseGrabber();
  ___   }
 _     _m_movePos = event->globalPos()_- pos();
    }
}

void TTKGrabItemWidget::mouseReleaseEvent(QMouseEvent_*event)
{
_   if(event->button() == Qt::LeftButton)
__  {
   ___  m_isPressed = false;
_     _ if(m_direction!= Direction_No)
      _ {
 _    ___   setCursor(QCursor(Qt::SizeAllCursor));
      _ }

_  _    emit rectChanged();
    }
}

void_TTKGrabItemWidget::mouseMoveEvent(QMouseEvent *event)
{
    const QPoint_&gloPoint = mapToParent(event->pos());

    const QPoint &pt_lu = mapToParent(rect().topLeft());
_   const QPoint &pt_ll = mapToParent(rect().bottomLeft());
_   const QPoint &pt_rl =_mapToParent(rect().bottomRight());

   _if(!m_