Back to index

salome-gui  6.5.0
Public Member Functions | Private Member Functions | Private Attributes
QtxMainWindow::Resizer Class Reference

Internal object used to resize dock widgets. More...

Inheritance diagram for QtxMainWindow::Resizer:
Inheritance graph
[legend]
Collaboration diagram for QtxMainWindow::Resizer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Resizer (const QPoint &, const Qt::Orientation, QtxMainWindow *)
 Constructor.
virtual ~Resizer ()
 Destructor.
QMouseEvent * finalEvent () const
void setFinalEvent (QMouseEvent *)
void setPosition (const QPoint &)
virtual bool eventFilter (QObject *, QEvent *)
 Event filter.

Private Member Functions

void setFilters (bool)

Private Attributes

QPoint myPos
QMainWindow * myMain
QRubberBand * myRubber
Qt::Orientation myOrient
QMouseEvent * myFinEvent

Detailed Description

Internal object used to resize dock widgets.

Definition at line 105 of file QtxMainWindow.cxx.


Constructor & Destructor Documentation

QtxMainWindow::Resizer::Resizer ( const QPoint &  p,
const Qt::Orientation  o,
QtxMainWindow mw 
)

Constructor.

Parameters:
mwparent main window

Definition at line 132 of file QtxMainWindow.cxx.

: QObject( mw ),
  myMain( mw ),
  myOrient( o ),
  myFinEvent( 0 )
{
  setFilters( true );

  myRubber = new QRubberBand( QRubberBand::Line, 0 );

  setPosition( p );

  myRubber->hide();
};

Here is the call graph for this function:

Destructor.

Definition at line 150 of file QtxMainWindow.cxx.

{
  delete myRubber;

  setFilters( false );
}

Member Function Documentation

bool QtxMainWindow::Resizer::eventFilter ( QObject o,
QEvent *  e 
) [virtual]

Event filter.

Parameters:
orecevier object
eevent

Definition at line 194 of file QtxMainWindow.cxx.

{
  if ( e->type() == QEvent::Timer ) {
    if ( !finalEvent() )
      return true;

    setFilters( false );
    QApplication::postEvent( myMain, finalEvent() );
    myFinEvent = 0;
    deleteLater();
  }

  return QObject::eventFilter( o, e );
}
QMouseEvent * QtxMainWindow::Resizer::finalEvent ( ) const

Definition at line 178 of file QtxMainWindow.cxx.

{
  return myFinEvent;
}
void QtxMainWindow::Resizer::setFilters ( bool  on) [private]

Definition at line 209 of file QtxMainWindow.cxx.

{
  if ( myMain ) {
    if ( on )
      myMain->layout()->installEventFilter( this );
    else
      myMain->layout()->removeEventFilter( this );
  }

  QTimer* t = qFindChild<QTimer*>( myMain->layout() );
  if ( t ) {
    if ( on )
      t->installEventFilter( this );
    else
      t->removeEventFilter( this );
  }
}

Here is the caller graph for this function:

Definition at line 183 of file QtxMainWindow.cxx.

{
  myFinEvent = e;
}
void QtxMainWindow::Resizer::setPosition ( const QPoint &  pos)

Definition at line 157 of file QtxMainWindow.cxx.

{
  myPos = pos;
  if ( myRubber ) {
    QRect r;
    QPoint min = myMain->mapToGlobal( myMain->rect().topLeft() );
    QPoint max = myMain->mapToGlobal( myMain->rect().bottomRight() );
    if ( myOrient == Qt::Horizontal ) {
      int p = qMax( qMin( myPos.y(), max.y() ), min.y() );
      r = QRect( myMain->mapToGlobal( QPoint( 0, 0 ) ).x(), p - 1, myMain->width(), 3 );
    }
    else {
      int p = qMax( qMin( myPos.x(), max.x() ), min.x() );
      r = QRect( p - 1, myMain->mapToGlobal( QPoint( 0, 0 ) ).y(), 3, myMain->height() );
    }
    myRubber->setGeometry( r );
    if ( !myRubber->isVisible() )
      myRubber->show();
  }
}

Here is the caller graph for this function:


Member Data Documentation

QMouseEvent* QtxMainWindow::Resizer::myFinEvent [private]

Definition at line 125 of file QtxMainWindow.cxx.

QMainWindow* QtxMainWindow::Resizer::myMain [private]

Definition at line 122 of file QtxMainWindow.cxx.

Definition at line 124 of file QtxMainWindow.cxx.

Definition at line 121 of file QtxMainWindow.cxx.

QRubberBand* QtxMainWindow::Resizer::myRubber [private]

Definition at line 123 of file QtxMainWindow.cxx.


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