Back to index

salome-gui  6.5.0
Public Member Functions | Private Member Functions | Private Attributes
QtxWorkstackDrag Class Reference

Workstack drag object. More...

#include <QtxWorkstack.h>

Inheritance diagram for QtxWorkstackDrag:
Inheritance graph
[legend]
Collaboration diagram for QtxWorkstackDrag:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QtxWorkstackDrag (QtxWorkstack *, QtxWorkstackChild *)
 Constructor.
virtual ~QtxWorkstackDrag ()
 Destructor.
virtual bool eventFilter (QObject *, QEvent *)
 Custom event filter.

Private Member Functions

void dropWidget ()
 Called when drop operation is finished.
void updateTarget (const QPoint &)
 Detect and set dropping target widget.
QtxWorkstackAreadetectTarget (const QPoint &, int &) const
 Detect dropping target.
void setTarget (QtxWorkstackArea *, const int)
 Set dropping target.
void drawRect ()
 Draw floating rectangle.
void endDrawRect ()
 Delete rubber band on the end on the dragging operation.
void startDrawRect ()
 Create rubber band to be drawn on the dragging operation.

Private Attributes

QtxWorkstackmyWS
 parent workstack
QtxWorkstackChildmyChild
 workstack child widget container
int myTab
 workarea tab page index
QtxWorkstackAreamyArea
 workarea
QRubberBand * myTabRect
 tab bar rubber band
QRubberBand * myAreaRect
 workarea rubber band

Detailed Description

Workstack drag object.

Definition at line 375 of file QtxWorkstack.h.


Constructor & Destructor Documentation

Constructor.

Parameters:
wsparent workstack
childchild widget container

Definition at line 93 of file QtxWorkstack.cxx.

: QObject( 0 ),
  myWS( ws ),
  myChild( child ),
  myTab( -1 ),
  myArea( 0 ),
  myTabRect( 0 ),
  myAreaRect( 0 )
{
  QApplication::instance()->installEventFilter( this );
}

Destructor.

Definition at line 108 of file QtxWorkstack.cxx.

{
  QApplication::instance()->removeEventFilter( this );

  endDrawRect();
}

Here is the call graph for this function:


Member Function Documentation

QtxWorkstackArea * QtxWorkstackDrag::detectTarget ( const QPoint &  p,
int &  tab 
) const [private]

Detect dropping target.

Parameters:
pcurrent dragging position
tabresulting target tab page index
Returns:
target workarea or 0 if there is no correct drop target

Definition at line 157 of file QtxWorkstack.cxx.

{
  if ( p.isNull() )
    return 0;

  QtxWorkstackArea* area = myWS->areaAt( p );
  if ( area )
    tab = area->tabAt( p );
  return area;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Draw floating rectangle.

Definition at line 204 of file QtxWorkstack.cxx.

{
  if ( !myArea )
    return;

  QRect r = myArea->floatRect();
  int m = 2;

  r.setTop( r.top() + m + 2 );
  r.setLeft( r.left() + m + 2 );
  r.setRight( r.right() - m - 2 );
  r.setBottom( r.bottom() - m - 2 );

  if ( myAreaRect )
  {
    myAreaRect->setGeometry( r );
    myAreaRect->setVisible( r.isValid() );
  }

  QRect tr = myArea->floatTab( myTab );

  tr.setTop( tr.top() + m );
  tr.setLeft( tr.left() + m );
  tr.setRight( tr.right() - m );
  tr.setBottom( tr.bottom() - m );

  if ( myTabRect )
  {
    myTabRect->setGeometry( tr );
    myTabRect->setVisible( tr.isValid() );
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Called when drop operation is finished.

Inserts dropped widget to the target workarea.

Definition at line 195 of file QtxWorkstack.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Delete rubber band on the end on the dragging operation.

Definition at line 240 of file QtxWorkstack.cxx.

{
  delete myAreaRect;
  myAreaRect = 0;

  delete myTabRect;
  myTabRect = 0;
}

Here is the caller graph for this function:

bool QtxWorkstackDrag::eventFilter ( QObject ,
QEvent *  e 
) [virtual]

Custom event filter.

Parameters:
oevent receiver widget
eevent
Returns:
true if event should be filtered (stop further processing)

Definition at line 121 of file QtxWorkstack.cxx.

{
  switch ( e->type() )
  {
  case QEvent::MouseMove:
    updateTarget( ((QMouseEvent*)e)->globalPos() );
    break;
  case QEvent::MouseButtonRelease:
    drawRect();
    endDrawRect();
    dropWidget();
    deleteLater();
    break;
  default:
    return false;
  }
  return true;
}

Here is the call graph for this function:

void QtxWorkstackDrag::setTarget ( QtxWorkstackArea area,
const int  tab 
) [private]

Set dropping target.

Parameters:
areanew target workarea
tabtarget workarea's tab page index

Definition at line 173 of file QtxWorkstack.cxx.

{
  if ( !area || ( myArea == area && tab == myTab ) )
    return;

  startDrawRect();

  if ( myArea )
    drawRect();

  myTab = tab;
  myArea = area;

  if ( myArea )
    drawRect();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Create rubber band to be drawn on the dragging operation.

Definition at line 252 of file QtxWorkstack.cxx.

{
  if ( !myTabRect )
    myTabRect = new QRubberBand( QRubberBand::Rectangle );

  myTabRect->hide();

  if ( !myAreaRect )
    myAreaRect = new QRubberBand( QRubberBand::Rectangle );

  myAreaRect->hide();
}

Here is the caller graph for this function:

void QtxWorkstackDrag::updateTarget ( const QPoint &  p) [private]

Detect and set dropping target widget.

Parameters:
pcurrent dragging position

Definition at line 144 of file QtxWorkstack.cxx.

{
  int tab = -1;
  QtxWorkstackArea* area = detectTarget( p, tab );
  setTarget( area, tab );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

workarea

Definition at line 401 of file QtxWorkstack.h.

QRubberBand* QtxWorkstackDrag::myAreaRect [private]

workarea rubber band

Definition at line 403 of file QtxWorkstack.h.

workstack child widget container

Definition at line 398 of file QtxWorkstack.h.

int QtxWorkstackDrag::myTab [private]

workarea tab page index

Definition at line 400 of file QtxWorkstack.h.

QRubberBand* QtxWorkstackDrag::myTabRect [private]

tab bar rubber band

Definition at line 402 of file QtxWorkstack.h.

parent workstack

Definition at line 397 of file QtxWorkstack.h.


The documentation for this class was generated from the following files: