Back to index

salome-gui  6.5.0
Public Member Functions
QtxWorkstackSplitter Class Reference

Workstack splitter. More...

#include <QtxWorkstack.h>

List of all members.

Public Member Functions

 QtxWorkstackSplitter (QWidget *=0)
 Constructor.
virtual ~QtxWorkstackSplitter ()
 Destructor.
QtxWorkstackworkstack () const
 Get parent workstack.
void saveState (QDataStream &) const
 Save the widget area configuration into data stream.
bool restoreState (QDataStream &, QMap< QString, QtxWorkstackChild * > &)
 Restore the widget area configuration from data stream info.

Detailed Description

Workstack splitter.

Definition at line 189 of file QtxWorkstack.h.


Constructor & Destructor Documentation

QtxWorkstackSplitter::QtxWorkstackSplitter ( QWidget *  parent = 0)

Constructor.

Parameters:
parentparent widget

Definition at line 392 of file QtxWorkstack.cxx.

: QSplitter( parent )
{
  setChildrenCollapsible( false );
}

Here is the caller graph for this function:

Destructor.

Definition at line 401 of file QtxWorkstack.cxx.

{
}

Member Function Documentation

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

Restore the widget area configuration from data stream info.

Returns:
true in successful case.

Definition at line 458 of file QtxWorkstack.cxx.

{
  int num = 0;
  uchar flags = 0;

  stream >> flags;
  stream >> num;

  setOrientation( flags & QtxWorkstack::Horizontal ? Qt::Horizontal : Qt::Vertical );

  QList<int> sz;
  for ( int s = 0; s < num; s++ )
  {
    int sn = 0;
    stream >> sn;
    sz.append( sn );
  }

  bool ok = true;
  for ( int i = 0; i < num && ok; i++ )
  {
    int marker;
    stream >> marker;

    if ( stream.status() != QDataStream::Ok )
      return false;

    if ( marker == QtxWorkstack::SplitMarker )
    {
      QtxWorkstackSplitter* split = new QtxWorkstackSplitter( this );
      addWidget( split );
      split->setVisible( true );

      ok = split->restoreState( stream, map );
    }
    else if ( marker == QtxWorkstack::AreaMarker )
    {
      QtxWorkstack* ws = workstack();
      QtxWorkstackArea* area = ws->createArea( this );
      addWidget( area );
      area->setVisible( true );

      ok = area->restoreState( stream, map );
    }
    else
      return false;
  }

  if ( ok )
    setSizes( sz );

  return ok;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QtxWorkstackSplitter::saveState ( QDataStream &  stream) const

Save the widget area configuration into data stream.

Definition at line 424 of file QtxWorkstack.cxx.

{
  stream << QtxWorkstack::SplitMarker;

  uchar flags = 0;
  if ( orientation() == Qt::Horizontal )
    flags |= QtxWorkstack::Horizontal;

  stream << flags;
  stream << count();

  QList<int> sz = sizes();
  for ( QList<int>::const_iterator it = sz.begin(); it != sz.end(); ++it )
    stream << *it;

  for ( int i = 0; i < count(); i++ )
  {
    QWidget* wid = widget( i );
    QtxWorkstackSplitter* split = ::qobject_cast<QtxWorkstackSplitter*>( wid );
    if ( split )
      split->saveState( stream );
    else
    {
      QtxWorkstackArea* area = ::qobject_cast<QtxWorkstackArea*>( wid );
      if ( area )
              area->saveState( stream );
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Get parent workstack.

Returns:
workstack owning this workarea

Definition at line 409 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:


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