Back to index

salome-gui  6.5.0
Classes | Signals | Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes
QtxWorkstackArea Class Reference

Workstack widget workarea. More...

#include <QtxWorkstack.h>

Collaboration diagram for QtxWorkstackArea:
Collaboration graph
[legend]

List of all members.

Classes

class  RestoreEvent
 Internal class used to forward restore info events to the workarea. More...
class  WidgetEvent
 Internal class used to forward child widgets events to the workarea. More...

Signals

void activated (QWidget *)
 Emitted when child widget is activated.
void contextMenuRequested (QWidget *, QPoint)
 Emitted when context popup menu is requested.
void deactivated (QtxWorkstackArea *)
 Emitted when workarea is deactivated.

Public Member Functions

 QtxWorkstackArea (QWidget *)
 Constructor.
virtual ~QtxWorkstackArea ()
 Destructor.
bool isNull () const
 Check if workarea contains any widgets.
bool isEmpty () const
 Check if workarea contains visible widgets.
QtxWorkstackChildinsertWidget (QWidget *, const int=-1, Qt::WindowFlags=0)
 Add widget to the workarea.
void removeWidget (QWidget *, const bool=true)
 Remove widget from workarea.
void insertChild (QtxWorkstackChild *, const int=-1)
void removeChild (QtxWorkstackChild *, const bool=true)
 Remove child from workarea.
QWidget * activeWidget () const
 Get active child widget.
void setActiveWidget (QWidget *)
 Set active widget.
bool contains (QWidget *) const
 Check if area owns the specified widget.
QWidgetList widgetList () const
 Get all visible child widgets.
QList< QtxWorkstackChild * > childList () const
bool isActive () const
 Check if workarea is active.
void updateActiveState ()
 Update active tab bar state (active/inactive).
QtxWorkstackworkstack () const
 Get parent workstack.
virtual bool eventFilter (QObject *, QEvent *)
 Custom event filter.
QRect floatRect () const
 Get rectangle to be drawn when highlighting drop area.
QRect floatTab (const int) const
 Get rectangle to be drawn when highlighting drop area on tab bar.
int tabAt (const QPoint &) const
 Get tab index by point.
void saveState (QDataStream &) const
 Save the own widgets configuration into data stream.
bool restoreState (QDataStream &, QMap< QString, QtxWorkstackChild * > &)
 Restore the widgets configuration from data stream info.

Protected Member Functions

virtual void customEvent (QEvent *)
 Event handler for custom events.
virtual void focusInEvent (QFocusEvent *)
 Customize focus in event handler.
virtual void mousePressEvent (QMouseEvent *)
 Customize mouse press event handler.

Private Types

enum  { ActivateWidget = QEvent::User, FocusWidget, MakeCurrent, RestoreWidget }
 Custom events. More...
typedef QList
< QtxWorkstackChild * > 
ChildList

Private Slots

void onClose ()
 Called when user presses "Close" button.
void onCurrentChanged (int)
 Called when user selects any tab page.
void onChildDestroyed (QObject *)
 Called when area's child widget container is destroyed.
void onChildShown (QtxWorkstackChild *)
 Called when child widget container is shown.
void onChildHidden (QtxWorkstackChild *)
 Called when child widget container is hidden.
void onChildActivated (QtxWorkstackChild *)
 Called when child widget container is activated.
void onChildCaptionChanged (QtxWorkstackChild *)
 Called when child widget container's title is changed.
void onDragActiveTab ()
 Called when user starts tab page dragging.
void onContextMenuRequested (QPoint)
 Create and show popup menu for the area.

Private Member Functions

void updateState ()
 Update internal state.
void updateCurrent ()
 Update current child widget container.
void updateTab (QWidget *)
 Update tab bar.
QWidget * widget (const int) const
 Get child widget by specified identifier.
int widgetId (QWidget *) const
 Get child widget identifier.
QtxWorkstackChildchild (QWidget *) const
 Get child widget container.
QtxWorkstackChildchild (const int) const
void setWidgetActive (QWidget *)
 Set active child widget.
int generateId () const
 Generate unique widget identifier.

Private Attributes

QtxWorkstackTabBarmyBar
 workarea tab bar header
ChildList myList
 child widgets list
QAbstractButton * myClose
 close button
QStackedWidget * myStack
 widget stack

Detailed Description

Workstack widget workarea.

Definition at line 203 of file QtxWorkstack.h.


Member Typedef Documentation

Definition at line 293 of file QtxWorkstack.h.


Member Enumeration Documentation

anonymous enum [private]

Custom events.

Enumerator:
ActivateWidget 

activate widget event

FocusWidget 

focus receiving widget event

MakeCurrent 
RestoreWidget 

Definition at line 271 of file QtxWorkstack.h.


Constructor & Destructor Documentation

QtxWorkstackArea::QtxWorkstackArea ( QWidget *  parent)

Constructor.

Parameters:
parentparent widget

Definition at line 522 of file QtxWorkstack.cxx.

: QFrame( parent )
{
  setFrameStyle( QFrame::Panel | QFrame::Sunken );

  QVBoxLayout* base = new QVBoxLayout( this );
  base->setMargin( frameWidth() );
  base->setSpacing( 0 );

  QWidget* top = new QWidget( this );
  base->addWidget( top );

  QHBoxLayout* tl = new QHBoxLayout( top );
  tl->setMargin( 0 );

  myBar = new QtxWorkstackTabBar( top );
  tl->addWidget( myBar, 1 );

  CloseButton* close = new CloseButton( top );
  close->setIcon( style()->standardIcon( QStyle::SP_TitleBarCloseButton ) );
  myClose = close;
  tl->addWidget( myClose );

  myStack = new QStackedWidget( this );

  base->addWidget( myStack, 1 );

  connect( myClose, SIGNAL( clicked() ), this, SLOT( onClose() ) );
  connect( myBar, SIGNAL( currentChanged( int ) ), this, SLOT( onCurrentChanged( int ) ) );
  connect( myBar, SIGNAL( dragActiveTab() ), this, SLOT( onDragActiveTab() ) );
  connect( myBar, SIGNAL( contextMenuRequested( QPoint ) ), this, SLOT( onContextMenuRequested( QPoint ) ) );

  updateState();

  updateActiveState();

  QApplication::instance()->installEventFilter( this );
}

Here is the call graph for this function:

Destructor.

Definition at line 564 of file QtxWorkstack.cxx.

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

Member Function Documentation

void QtxWorkstackArea::activated ( QWidget *  w) [signal]

Emitted when child widget is activated.

Parameters:
wchild widget being activated

Here is the caller graph for this function:

QWidget * QtxWorkstackArea::activeWidget ( ) const

Get active child widget.

Returns:
active widget

Definition at line 739 of file QtxWorkstack.cxx.

{
  return widget( myBar->tabId( myBar->currentIndex() ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

QtxWorkstackChild * QtxWorkstackArea::child ( QWidget *  wid) const [private]

Get child widget container.

Parameters:
widchild widget
Returns:
child widget container corresponding to the wid

Definition at line 1285 of file QtxWorkstack.cxx.

{
  QtxWorkstackChild* res = 0;
  for ( ChildList::const_iterator it = myList.begin(); it != myList.end() && !res; ++it )
  {
    if ( (*it)->widget() == wid )
      res = *it;
  }
  return res;
}

Here is the caller graph for this function:

QtxWorkstackChild * QtxWorkstackArea::child ( const int  id) const [private]

Definition at line 1296 of file QtxWorkstack.cxx.

{
  QtxWorkstackChild* c = 0;
  for ( ChildList::const_iterator it = myList.begin(); it != myList.end() && !c; ++it )
  {
    if ( (*it)->id() == id )
      c = *it;
  }
  return c;
}

Definition at line 714 of file QtxWorkstack.cxx.

{
  return myList;
}
bool QtxWorkstackArea::contains ( QWidget *  wid) const

Check if area owns the specified widget.

Parameters:
widwidget to be checked
Returns:
true if area contains widget

Definition at line 758 of file QtxWorkstack.cxx.

{
  return child( wid );
}

Here is the call graph for this function:

void QtxWorkstackArea::contextMenuRequested ( QWidget *  w,
QPoint  p 
) [signal]

Emitted when context popup menu is requested.

Parameters:
wchild widget popup menu requested for
ppoint popup menu to be shown at

Here is the caller graph for this function:

void QtxWorkstackArea::customEvent ( QEvent *  e) [protected, virtual]

Event handler for custom events.

Parameters:
ecustom event

Definition at line 948 of file QtxWorkstack.cxx.

{
  WidgetEvent* we = (WidgetEvent*)e;

  switch ( we->type() )
  {
  case ActivateWidget:
    myBar->updateActiveState();
    emit activated( activeWidget() );
    break;
  case FocusWidget:
    if ( activeWidget() )
    {
      if ( !activeWidget()->focusWidget() )
        activeWidget()->setFocus();
      else
      {
        if ( activeWidget()->focusWidget()->hasFocus() )
        {
          QFocusEvent in( QEvent::FocusIn );
                QApplication::sendEvent( this, &in );
              }
        else
        {
          activeWidget()->focusWidget()->setFocus();
                myBar->updateActiveState();
              }
      }
    }
    break;
  case MakeCurrent:
    if ( we->child()->widget() )
      setActiveWidget( we->child()->widget() );
    break;
  case RestoreWidget:
    if ( we->child() )
    {
      QtxWorkstackChild* c = we->child();
      RestoreEvent* re = (RestoreEvent*)we;
      if ( c->widget() )
        c->widget()->setVisible( re->flags() & QtxWorkstack::Visible );
      c->setId( re->id() );
      insertChild( c );
    }
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

Emitted when workarea is deactivated.

Parameters:
waworkarea being deactivated

Here is the caller graph for this function:

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

Custom event filter.

Process events from child widgets.

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

Definition at line 809 of file QtxWorkstack.cxx.

{
  if ( o->isWidgetType() )
  {
    QWidget* wid = (QWidget*)o;
    if ( e->type() == QEvent::FocusIn || e->type() == QEvent::MouseButtonPress )
    {
      bool ok = false;
      while ( !ok && wid && wid != myClose )
      {
        ok = wid == this;
        wid = wid->parentWidget();
      }
      if ( ok )
        QApplication::postEvent( this, new WidgetEvent( (QEvent::Type)( e->type() == QEvent::FocusIn ? ActivateWidget : FocusWidget ) ) );
    }
  }
  return false;
}
QRect QtxWorkstackArea::floatRect ( ) const

Get rectangle to be drawn when highlighting drop area.

Returns:
area drop rectangle

Definition at line 909 of file QtxWorkstack.cxx.

{
  QRect r = myStack->geometry();
  return QRect( mapToGlobal( r.topLeft() ), mapToGlobal( r.bottomRight() ) );
}

Here is the caller graph for this function:

QRect QtxWorkstackArea::floatTab ( const int  idx) const

Get rectangle to be drawn when highlighting drop area on tab bar.

Parameters:
idxtab index
Returns:
tab bar drop rectrangle

Definition at line 920 of file QtxWorkstack.cxx.

{
  QRect r = myBar->tabRect( idx );
  return QRect( myBar->mapToGlobal( r.topLeft() ), r.size() );
}

Here is the caller graph for this function:

void QtxWorkstackArea::focusInEvent ( QFocusEvent *  e) [protected, virtual]

Customize focus in event handler.

Parameters:
efocus in event

Definition at line 1002 of file QtxWorkstack.cxx.

Here is the call graph for this function:

int QtxWorkstackArea::generateId ( ) const [private]

Generate unique widget identifier.

Returns:
first non shared widget ID

Definition at line 1266 of file QtxWorkstack.cxx.

{
  QMap<int, int> map;

  for ( ChildList::const_iterator it = myList.begin(); it != myList.end(); ++it )
    map.insert( (*it)->id(), 0 );

  int id = 0;
  while ( map.contains( id ) )
    id++;

  return id;
}

Here is the caller graph for this function:

void QtxWorkstackArea::insertChild ( QtxWorkstackChild child,
const int  idx = -1 
)

Definition at line 611 of file QtxWorkstack.cxx.

{
  if ( !child )
    return;

  QtxWorkstackArea* a = child->area();
  if ( a && a != this )
    a->removeChild( child, false );

  int pos = myList.indexOf( child );
  if ( pos != -1 && ( pos == idx || ( idx < 0 && pos == (int)myList.count() - 1 ) ) )
    return;

  bool found = myList.contains( child );

  myList.removeAll( child );
  pos = idx < 0 ? myList.count() : idx;
  myList.insert( qMin( pos, (int)myList.count() ), child );

  if ( !found )
  {
    bool hasId = false;
    for ( ChildList::const_iterator it = myList.begin(); it != myList.end() && !hasId; ++it )
      hasId = (*it)->id() == child->id();

    if ( hasId || child->id() < 0 )
      child->setId( generateId() );

    connect( child, SIGNAL( destroyed( QObject* ) ), this, SLOT( onChildDestroyed( QObject* ) ) );
    connect( child, SIGNAL( shown( QtxWorkstackChild* ) ), this, SLOT( onChildShown( QtxWorkstackChild* ) ) );
    connect( child, SIGNAL( hidden( QtxWorkstackChild* ) ), this, SLOT( onChildHidden( QtxWorkstackChild* ) ) );
    connect( child, SIGNAL( activated( QtxWorkstackChild* ) ), this, SLOT( onChildActivated( QtxWorkstackChild* ) ) );
    connect( child, SIGNAL( captionChanged( QtxWorkstackChild* ) ), this, SLOT( onChildCaptionChanged( QtxWorkstackChild* ) ) );
  }

  updateState();

  setWidgetActive( child->widget() );
  child->widget()->setFocus();
}

Here is the call graph for this function:

Here is the caller graph for this function:

QtxWorkstackChild * QtxWorkstackArea::insertWidget ( QWidget *  wid,
const int  idx = -1,
Qt::WindowFlags  f = 0 
)

Add widget to the workarea.

Parameters:
widwidget to be added
idxposition in the area widget to be added to
fwidget flags
Returns:
child widget container object (or 0 if index is invalid)

Definition at line 597 of file QtxWorkstack.cxx.

{
  if ( !wid )
    return 0;

  QtxWorkstackChild* c = child( wid );
  if ( !c )
    c = new QtxWorkstackChild( wid, myStack, f );

  insertChild( c, idx );

  return c;
}

Here is the call graph for this function:

Check if workarea is active.

Returns:
true if area is active

Definition at line 767 of file QtxWorkstack.cxx.

{
  QtxWorkstack* ws = workstack();
  if ( !ws )
    return false;

  return ws->activeArea() == this;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool QtxWorkstackArea::isEmpty ( ) const

Check if workarea contains visible widgets.

Returns:
true if area is empty (all child widgets are removed or now shown)

Definition at line 582 of file QtxWorkstack.cxx.

{
  bool res = false;
  for ( ChildList::const_iterator it = myList.begin(); it != myList.end() && !res; ++it )
    res = (*it)->visibility();
  return !res;
}

Here is the caller graph for this function:

bool QtxWorkstackArea::isNull ( ) const

Check if workarea contains any widgets.

Returns:
true if area is null (havn't any child widgets)

Definition at line 573 of file QtxWorkstack.cxx.

{
  return myList.isEmpty();
}

Here is the caller graph for this function:

void QtxWorkstackArea::mousePressEvent ( QMouseEvent *  e) [protected, virtual]

Customize mouse press event handler.

Parameters:
emouse press event

Definition at line 1015 of file QtxWorkstack.cxx.

Here is the call graph for this function:

Called when child widget container is activated.

Parameters:
cchild widget container being activated

Definition at line 1086 of file QtxWorkstack.cxx.

{
  setWidgetActive( c->widget() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Called when child widget container's title is changed.

Parameters:
cchild widget container which title is changed

Definition at line 1095 of file QtxWorkstack.cxx.

{
  updateTab( c->widget() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::onChildDestroyed ( QObject obj) [private, slot]

Called when area's child widget container is destroyed.

Parameters:
objwidget container being destroyed

Definition at line 1059 of file QtxWorkstack.cxx.

{
  removeChild( (QtxWorkstackChild*)obj, false );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Called when child widget container is hidden.

Parameters:
cchild widget container being hidden

Definition at line 1077 of file QtxWorkstack.cxx.

{
  updateState();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Called when child widget container is shown.

Parameters:
cchild widget container being shown

Definition at line 1068 of file QtxWorkstack.cxx.

{
  updateState();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::onClose ( ) [private, slot]

Called when user presses "Close" button.

Definition at line 1025 of file QtxWorkstack.cxx.

{
  QWidget* wid = activeWidget();
  if ( wid )
    wid->close();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::onContextMenuRequested ( QPoint  p) [private, slot]

Create and show popup menu for the area.

Parameters:
pmouse pointer position at which popup menu should be shown

Definition at line 656 of file QtxWorkstack.cxx.

{
  const QtxWorkstackTabBar* bar = ::qobject_cast<const QtxWorkstackTabBar*>( sender() );
  if ( !bar )
    return;

  QWidget* wid = 0;
  int idx = tabAt( p );
  if ( idx != -1 )
    wid = widget( myBar->tabId( idx ) );

  emit contextMenuRequested( wid, p );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::onCurrentChanged ( int  ) [private, slot]

Called when user selects any tab page.

Parameters:
idxtab page index (not used)

Definition at line 1036 of file QtxWorkstack.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Called when user starts tab page dragging.

Definition at line 1046 of file QtxWorkstack.cxx.

{
  QtxWorkstackChild* c = child( activeWidget() );
  if ( !c )
    return;

  new QtxWorkstackDrag( workstack(), c );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::removeChild ( QtxWorkstackChild child,
const bool  del = true 
)

Remove child from workarea.

Parameters:
childchild to be removed
delif true the widget should be also deleted

Definition at line 685 of file QtxWorkstack.cxx.

{
  if ( !myList.contains( child ) )
    return;

  myStack->removeWidget( child );

  if ( myBar->indexOf( child->id() ) != -1 )
    myBar->removeTab( myBar->indexOf( child->id() ) );

  myList.removeAll( child );

  if ( del )
    delete child;
  else if ( child->widget() )
  {
    disconnect( child, SIGNAL( destroyed( QObject* ) ), this, SLOT( onChildDestroyed( QObject* ) ) );
    disconnect( child, SIGNAL( shown( QtxWorkstackChild* ) ), this, SLOT( onChildShown( QtxWorkstackChild* ) ) );
    disconnect( child, SIGNAL( hidden( QtxWorkstackChild* ) ), this, SLOT( onChildHidden( QtxWorkstackChild* ) ) );
    disconnect( child, SIGNAL( activated( QtxWorkstackChild* ) ), this, SLOT( onChildActivated( QtxWorkstackChild* ) ) );
    disconnect( child, SIGNAL( captionChanged( QtxWorkstackChild* ) ), this, SLOT( onChildCaptionChanged( QtxWorkstackChild* ) ) );
  }

  if ( isNull() )
    deleteLater();
  else
    updateState();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::removeWidget ( QWidget *  wid,
const bool  del = true 
)

Remove widget from workarea.

Parameters:
widwidget to be removed
delif true the widget should be also deleted

Definition at line 675 of file QtxWorkstack.cxx.

{
  removeChild( child( wid ), del );
}

Here is the call graph for this function:

bool QtxWorkstackArea::restoreState ( QDataStream &  stream,
QMap< QString, QtxWorkstackChild * > &  map 
)

Restore the widgets configuration from data stream info.

Returns:
true in successful case.

Definition at line 858 of file QtxWorkstack.cxx.

{
  int num = 0;
  int cur = -1;

  stream >> num;
  stream >> cur;

  QtxWorkstackChild* curChild = 0;
  for ( int i = 0; i < num; i++ )
  {
    int marker;
    stream >> marker;

    if ( stream.status() != QDataStream::Ok || marker != QtxWorkstack::WidgetMarker )
      return false;

    QString name;
    stream >> name;

    int id = -1;
    stream >> id;

    uchar flags = 0;
    stream >> flags;

    QtxWorkstackChild* c = map.contains( name ) ? map[name] : 0;
    if ( !c )
    {
      qWarning( "QtxWorkstack: Restored child widget \"%s\" not found.", (const char*)name.toLatin1() );
      return false;
    }

    map.remove( name );

    if ( id == cur )
      curChild = c;

    QApplication::postEvent( this, new RestoreEvent( (QEvent::Type)RestoreWidget, id, flags, c ) );
  }

  if ( curChild )
    QApplication::postEvent( this, new WidgetEvent( (QEvent::Type)MakeCurrent, curChild ) );

  return true;
}

Here is the caller graph for this function:

void QtxWorkstackArea::saveState ( QDataStream &  stream) const

Save the own widgets configuration into data stream.

Definition at line 832 of file QtxWorkstack.cxx.

{
  stream << QtxWorkstack::AreaMarker;
  stream << myList.count();
  stream << myBar->tabId( myBar->currentIndex() );
  for ( ChildList::const_iterator it = myList.begin(); it != myList.end(); ++it )
  {
    QtxWorkstackChild* c = *it;

    stream << QtxWorkstack::WidgetMarker;

    stream << c->widget()->objectName();
    stream << c->id();

    uchar flags = 0;
    if ( c->visibility() )
      flags |= QtxWorkstack::Visible;

    stream << flags;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Set active widget.

Parameters:
widwidget to be made active

Definition at line 748 of file QtxWorkstack.cxx.

{
  myBar->setCurrentIndex( myBar->indexOf( widgetId( wid ) ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::setWidgetActive ( QWidget *  wid) [private]

Set active child widget.

Parameters:
widwidget to be set active

Definition at line 1154 of file QtxWorkstack.cxx.

{
  int id = widgetId( wid );
  if ( id < 0 )
    return;

  myBar->setCurrentIndex( myBar->indexOf( id ) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

int QtxWorkstackArea::tabAt ( const QPoint &  pnt) const

Get tab index by point.

Parameters:
ppoint
Returns:
tab covering point or -1 if there is no tab covering point

Definition at line 931 of file QtxWorkstack.cxx.

{
  int idx = -1;
  QPoint p = myBar->mapFromGlobal( pnt );
  for ( int i = 0; i < myBar->count() && idx == -1; i++ )
  {
    QRect r = myBar->tabRect( i );
    if ( r.isValid() && r.contains( p ) )
      idx = i;
  }
  return idx;
}

Here is the caller graph for this function:

Update active tab bar state (active/inactive).

Definition at line 779 of file QtxWorkstack.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Update current child widget container.

Raises widget when active tab page is changed.

Definition at line 1105 of file QtxWorkstack.cxx.

{
  QWidget* cur = child( widget( myBar->tabId( myBar->currentIndex() ) ) );
  if ( cur )
    myStack->setCurrentWidget( cur );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Update internal state.

Definition at line 1166 of file QtxWorkstack.cxx.

{
  bool updBar = myBar->updatesEnabled();
  bool updStk = myStack->updatesEnabled();
  myBar->setUpdatesEnabled( false );
  myStack->setUpdatesEnabled( false );

  bool block = myBar->signalsBlocked();
  myBar->blockSignals( true );

  QWidget* prev = activeWidget();

  int idx = 0;
  for ( ChildList::iterator it = myList.begin(); it != myList.end(); ++it )
  {
    QtxWorkstackChild* cont = *it;
    QWidget* wid = cont->widget();;
    int id = cont->id();

    if ( id < 0 )
      continue;

    bool vis = cont->visibility();

    int cIdx = myBar->indexOf( id );
    if ( cIdx != -1 && ( !vis || myBar->indexOf( id ) != idx ) )
      myBar->removeTab( cIdx );

    if ( myBar->indexOf( id ) == -1 && vis )
      myBar->setTabId( myBar->insertTab( idx, wid->windowTitle() ), id );

    updateTab( wid );

    if ( !vis )
      myStack->removeWidget( cont );
    else if ( myStack->indexOf( cont ) < 0 )
      myStack->addWidget( cont );

    if ( vis )
      idx++;
  }

  int curId = widgetId( prev );
  if ( myBar->indexOf( curId ) < 0 )
  {
    QtxWorkstackChild* c = 0;
    int pos = myList.indexOf( child( prev ) );
    for ( int i = pos - 1; i >= 0 && !c; i-- )
    {
      if ( myList.at( i )->visibility() )
        c = myList.at( i );
    }

    for ( int j = pos + 1; j < (int)myList.count() && !c; j++ )
    {
      if ( myList.at( j )->visibility() )
        c = myList.at( j );
    }

    if ( c )
      curId = c->id();
  }

  myBar->setCurrentIndex( myBar->indexOf( curId ) );

  myBar->blockSignals( block );

  updateCurrent();

  myBar->updateActiveState();

  myBar->setUpdatesEnabled( updBar );
  myStack->setUpdatesEnabled( updStk );
  if ( updBar )
    myBar->update();
  if ( updStk )
    myStack->update();

  QResizeEvent re( myBar->size(), myBar->size() );
  QApplication::sendEvent( myBar, &re );

  myBar->updateGeometry();

  if ( isEmpty() )
  {
    hide();
    emit deactivated( this );
  }
  else
  {
    show();
    if ( prev != activeWidget() )
      emit activated( activeWidget() );
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackArea::updateTab ( QWidget *  wid) [private]

Update tab bar.

Parameters:
widtab page widget

Definition at line 1116 of file QtxWorkstack.cxx.

{
  int idx = myBar->indexOf( widgetId( wid ) );
  if ( idx < 0 )
    return;

  myBar->setTabIcon( idx, wid->windowIcon() );
  myBar->setTabText( idx, wid->windowTitle() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

QWidget * QtxWorkstackArea::widget ( const int  id) const [private]

Get child widget by specified identifier.

Parameters:
idwidget ID
Returns:
widget or 0, if identifier in invalid

Definition at line 1131 of file QtxWorkstack.cxx.

{
  QtxWorkstackChild* c = child( id );

  return c ? c->widget() : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int QtxWorkstackArea::widgetId ( QWidget *  wid) const [private]

Get child widget identifier.

Parameters:
widwidget
Returns:
widget ID or -1 if widget is not found

Definition at line 1143 of file QtxWorkstack.cxx.

{
  QtxWorkstackChild* c = child( wid );

  return c ? c->id() : -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

QWidgetList QtxWorkstackArea::widgetList ( ) const

Get all visible child widgets.

Returns:
list of visible child widgets

Definition at line 723 of file QtxWorkstack.cxx.

{
  QWidgetList lst;
  for ( ChildList::const_iterator it = myList.begin(); it != myList.end(); ++it )
  {
    QtxWorkstackChild* c = *it;
    if ( c->visibility() )
      lst.append( c->widget() );
  }
  return lst;
}

Here is the call graph for this function:

Get parent workstack.

Returns:
workstack owning this workarea

Definition at line 788 of file QtxWorkstack.cxx.

{
  QtxWorkstack* ws = 0;
  QWidget* wid = parentWidget();
  while ( wid && !ws )
  {
    ws = ::qobject_cast<QtxWorkstack*>( wid );
    wid = wid->parentWidget();
  }
  return ws;
}

Here is the caller graph for this function:


Member Data Documentation

workarea tab bar header

Definition at line 296 of file QtxWorkstack.h.

QAbstractButton* QtxWorkstackArea::myClose [private]

close button

Definition at line 298 of file QtxWorkstack.h.

child widgets list

Definition at line 297 of file QtxWorkstack.h.

QStackedWidget* QtxWorkstackArea::myStack [private]

widget stack

Definition at line 299 of file QtxWorkstack.h.


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