Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::QFieldContainerView Class Reference

#include <OSGQFieldContainerView_qt.h>

List of all members.

Public Types

enum  ColumnNames { NameColumn = 0, ValueColumn = 1, TypeColumn = 2 }

Public Slots

void setFieldContainer (FieldContainerPtr pFC)
void setAspect (UInt32 uiAspect)
void setShowTypeColumn (bool bShowTypeCol)
void beginEdit (UInt32 uiFieldId, UInt32 uiIndex)
void endEdit (void)
void endEdit (UInt32 uiFieldId)

Signals

void clicked (FieldContainerPtr pFC, UInt32 uiFieldId, UInt32 uiIndex, ButtonState button)
void doubleClicked (FieldContainerPtr pFC, UInt32 uiFieldId, UInt32 uiIndex, ButtonState button)

Public Member Functions

 QFieldContainerView (QWidget *parent, const char *name=NULL)
 QFieldContainerView (FieldContainerPtr pFC, UInt32 uiAspect, QWidget *parent, const char *name=NULL)
virtual ~QFieldContainerView (void)
FieldContainerPtrgetFieldContainer (void)
const FieldContainerPtrgetFieldContainer (void) const
UInt32 getAspect (void) const
bool getShowTypeColumn (void) const

Protected Slots

void onClicked (FieldContainerPtr pFC, UInt32 uiFieldId, UInt32 uiIndex, ButtonState button)
void onDoubleClicked (FieldContainerPtr pFC, UInt32 uiFieldId, UInt32 uiIndex, ButtonState button)

Protected Member Functions

void resizeEvent (QResizeEvent *pEvent)

Private Types

typedef QWidget Inherited

Private Member Functions

void clearTable (void)
void fillTable (const FieldContainerPtr &pFC, UInt32 uiAspect)

Private Attributes

QTable * _pTable
FieldContainerPtr _pFC
UInt32 _uiAspect
bool _bShowTypeColumn

Classes

class  QWidgetTableItem


Detailed Description

Definition at line 59 of file OSGQFieldContainerView_qt.h.


Member Typedef Documentation

typedef QWidget osg::QFieldContainerView::Inherited [private]
 

Definition at line 113 of file OSGQFieldContainerView_qt.h.


Member Enumeration Documentation

enum osg::QFieldContainerView::ColumnNames
 

Enumerator:
NameColumn 
ValueColumn 
TypeColumn 

Definition at line 64 of file OSGQFieldContainerView_qt.h.

00064                      {
00065         NameColumn  = 0,
00066         ValueColumn = 1,
00067         TypeColumn  = 2
00068     };


Constructor & Destructor Documentation

QFieldContainerView::QFieldContainerView QWidget *  parent,
const char *  name = NULL
 

Definition at line 66 of file OSGQFieldContainerView_qt.cpp.

References _pTable.

00067     : Inherited       (parent, name                     ),
00068       _pFC            (NullFC                           ),
00069       _uiAspect       (Thread::getCurrent()->getAspect()),
00070       _bShowTypeColumn(true                             )
00071 {
00072     _pTable = new QTable(this, "QFieldContainerView::_pTable");
00073 
00074     _pTable->setNumCols      (3                  );
00075     _pTable->setReadOnly     (true               );
00076     _pTable->setSelectionMode(QTable::NoSelection);
00077 }

QFieldContainerView::QFieldContainerView FieldContainerPtr  pFC,
UInt32  uiAspect,
QWidget *  parent,
const char *  name = NULL
 

Definition at line 79 of file OSGQFieldContainerView_qt.cpp.

References _pTable, and setFieldContainer().

00083     : Inherited       (parent, name                     ),
00084       _pFC            (NullFC                           ),
00085       _uiAspect       (uiAspect                         ),
00086       _bShowTypeColumn(true                             )
00087 {
00088     _pTable = new QTable(this, "QFieldContainerView::_pTable");
00089 
00090     _pTable->setNumCols      (3                  );
00091     _pTable->setReadOnly     (true               );
00092     _pTable->setSelectionMode(QTable::NoSelection);
00093 
00094     setFieldContainer(pFC);
00095 }

QFieldContainerView::~QFieldContainerView void   )  [virtual]
 

Definition at line 97 of file OSGQFieldContainerView_qt.cpp.

00098 {
00099 }


Member Function Documentation

FieldContainerPtr & osg::QFieldContainerView::getFieldContainer void   )  [inline]
 

Definition at line 44 of file OSGQFieldContainerView_qt.inl.

References _pFC.

Referenced by setAspect().

00045 {
00046     return _pFC;
00047 }

const FieldContainerPtr & osg::QFieldContainerView::getFieldContainer void   )  const [inline]
 

Definition at line 50 of file OSGQFieldContainerView_qt.inl.

References _pFC.

00051 {
00052     return _pFC;
00053 }

UInt32 osg::QFieldContainerView::getAspect void   )  const [inline]
 

Definition at line 56 of file OSGQFieldContainerView_qt.inl.

References _uiAspect.

00057 {
00058     return _uiAspect;
00059 }

bool osg::QFieldContainerView::getShowTypeColumn void   )  const [inline]
 

Definition at line 62 of file OSGQFieldContainerView_qt.inl.

References _bShowTypeColumn.

00063 {
00064     return _bShowTypeColumn;
00065 }

void QFieldContainerView::setFieldContainer FieldContainerPtr  pFC  )  [slot]
 

Definition at line 102 of file OSGQFieldContainerView_qt.cpp.

References _pFC, _uiAspect, clearTable(), and fillTable().

Referenced by osg::QSceneGraphView::onSelectionChanged(), and QFieldContainerView().

00103 {
00104     clearTable();
00105 
00106     fillTable(pFC, _uiAspect);
00107 
00108     _pFC = pFC;
00109 }

void QFieldContainerView::setAspect UInt32  uiAspect  )  [slot]
 

Definition at line 112 of file OSGQFieldContainerView_qt.cpp.

References _uiAspect, clearTable(), fillTable(), and getFieldContainer().

Referenced by osg::QSceneGraphView::doShowAspect().

00113 {
00114     // TODO: check if this can be done smarter
00115 
00116     _uiAspect = uiAspect;
00117 
00118     clearTable();
00119 
00120     fillTable(getFieldContainer(), _uiAspect);
00121 }

void QFieldContainerView::setShowTypeColumn bool  bShowTypeCol  )  [slot]
 

Definition at line 124 of file OSGQFieldContainerView_qt.cpp.

References _bShowTypeColumn, _pTable, and TypeColumn.

00125 {
00126     _bShowTypeColumn = bShowTypeColumn;
00127 
00128     if(_bShowTypeColumn)
00129     {
00130         _pTable->showColumn  (TypeColumn);
00131         _pTable->adjustColumn(TypeColumn);
00132     }
00133     else
00134     {
00135         _pTable->hideColumn(TypeColumn);
00136     }
00137 }

void QFieldContainerView::beginEdit UInt32  uiFieldId,
UInt32  uiIndex
[slot]
 

Definition at line 140 of file OSGQFieldContainerView_qt.cpp.

References _pFC, _pTable, osg::QFieldViewBase::beginEdit(), and ValueColumn.

Referenced by osg::QSceneGraphView::onFieldDoubleClicked().

00141 {
00142     if((uiFieldId < 1) || (uiFieldId > _pFC->getType().getNumFieldDescs()))
00143         return;
00144 
00145     QFieldViewBase *pFView =
00146         dynamic_cast<QFieldViewBase *>(_pTable->cellWidget(uiFieldId-1,
00147                                                            ValueColumn ));
00148 
00149     if(pFView)
00150         pFView->beginEdit(uiIndex);
00151 }

void QFieldContainerView::endEdit void   )  [slot]
 

Definition at line 154 of file OSGQFieldContainerView_qt.cpp.

References _pTable, osg::QFieldViewBase::endEdit(), and ValueColumn.

00155 {
00156     int numRows = _pTable->numRows();
00157 
00158     for(int i=0; i < numRows; ++i)
00159     {
00160         QFieldViewBase *pFView =
00161             dynamic_cast<QFieldViewBase *>(
00162                 _pTable->cellWidget(i, ValueColumn));
00163 
00164         if(pFView)
00165             pFView->endEdit();
00166     }
00167 }

void QFieldContainerView::endEdit UInt32  uiFieldId  )  [slot]
 

Definition at line 170 of file OSGQFieldContainerView_qt.cpp.

References _pFC, _pTable, osg::QFieldViewBase::endEdit(), and ValueColumn.

00171 {
00172     if((uiFieldId < 1) || (uiFieldId > _pFC->getType().getNumFieldDescs()))
00173         return;
00174 
00175     QFieldViewBase *pFView =
00176         dynamic_cast<QFieldViewBase *>(_pTable->cellWidget(uiFieldId - 1,
00177                                                            ValueColumn   ));
00178 
00179     if(pFView)
00180         pFView->endEdit();
00181 }

void osg::QFieldContainerView::clicked FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiIndex,
ButtonState  button
[signal]
 

Referenced by fillTable(), and onClicked().

void osg::QFieldContainerView::doubleClicked FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiIndex,
ButtonState  button
[signal]
 

Referenced by fillTable(), and onDoubleClicked().

void QFieldContainerView::resizeEvent QResizeEvent *  pEvent  )  [protected]
 

Definition at line 184 of file OSGQFieldContainerView_qt.cpp.

References _pTable.

00185 {
00186     _pTable->resize(pEvent->size());
00187 }

void QFieldContainerView::onClicked FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiIndex,
ButtonState  button
[protected, slot]
 

Definition at line 190 of file OSGQFieldContainerView_qt.cpp.

References clicked().

Referenced by fillTable().

00194 {
00195     emit clicked(pFC, uiFieldId, uiIndex, button);
00196 }

void QFieldContainerView::onDoubleClicked FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiIndex,
ButtonState  button
[protected, slot]
 

Definition at line 199 of file OSGQFieldContainerView_qt.cpp.

References doubleClicked().

Referenced by fillTable().

00203 {
00204     emit doubleClicked(pFC, uiFieldId, uiIndex, button);
00205 }

void QFieldContainerView::clearTable void   )  [private]
 

Definition at line 208 of file OSGQFieldContainerView_qt.cpp.

References _pTable.

Referenced by setAspect(), and setFieldContainer().

00209 {
00210     UInt32 rows = _pTable->numRows();
00211 
00212     for(UInt32 i = rows; i > 0; --i)
00213     {
00214         _pTable->removeRow(i-1);
00215     }
00216 }

void QFieldContainerView::fillTable const FieldContainerPtr pFC,
UInt32  uiAspect
[private]
 

Definition at line 219 of file OSGQFieldContainerView_qt.cpp.

References _bShowTypeColumn, _pTable, clicked(), doubleClicked(), osg::QFieldViewBase::getFieldPtr(), osg::Field::getSize(), NameColumn, onClicked(), onDoubleClicked(), osg::FieldType::SINGLE_FIELD, TypeColumn, and ValueColumn.

Referenced by setAspect(), and setFieldContainer().

00220 {
00221     UInt32  uiNumFields = pFC->getType().getNumFieldDescs();
00222 
00223     _pTable->setNumRows(uiNumFields);
00224 
00225     for(UInt32 i = 0; i < uiNumFields; ++i)
00226     {
00227 
00228         if(pFC->getField(i+1)->getCardinality() == FieldType::SINGLE_FIELD)
00229         {
00230             QSFieldView *pSFView = new QSFieldView(pFC, i+1, uiAspect, this);
00231 
00232             _pTable->setCellWidget(i, ValueColumn, pSFView      );
00233 
00234 #if (QT_VERSION < 0x030301) || (QT_VERSION < 304)
00235             _pTable->setItem      (i, ValueColumn,
00236                                    new QWidgetTableItem(_pTable));
00237 #endif
00238 
00239             connect(pSFView,
00240                     SIGNAL(clicked        (FieldContainerPtr, UInt32,
00241                                            UInt32,            ButtonState)),
00242                     this,
00243                     SLOT  (onClicked      (FieldContainerPtr, UInt32,
00244                                            UInt32,            ButtonState)));
00245             connect(pSFView,
00246                     SIGNAL(doubleClicked  (FieldContainerPtr, UInt32,
00247                                            UInt32,            ButtonState)),
00248                     this,
00249                     SLOT  (onDoubleClicked(FieldContainerPtr, UInt32,
00250                                            UInt32,            ButtonState)));
00251             _pTable->setText(i, NameColumn,
00252                              pFC->getType().getFieldDescription(i+1)->getCName());
00253         }
00254         else
00255         {
00256             QMFieldView *pMFView = new QMFieldView(pFC, i+1, uiAspect, this);
00257 
00258             _pTable->setCellWidget(i, ValueColumn, pMFView      );
00259 
00260 #if (QT_VERSION < 0x030302) || (QT_VERSION < 304)
00261             _pTable->setItem      (i, ValueColumn,
00262                                    new QWidgetTableItem(_pTable));
00263 #endif
00264 
00265              connect(pMFView,
00266                      SIGNAL(clicked        (FieldContainerPtr, UInt32,
00267                                             UInt32,            ButtonState)),
00268                      this,
00269                      SLOT  (onClicked      (FieldContainerPtr, UInt32,
00270                                             UInt32,            ButtonState)));
00271              connect(pMFView,
00272                      SIGNAL(doubleClicked  (FieldContainerPtr, UInt32,
00273                                             UInt32,            ButtonState)),
00274                      this,
00275                      SLOT  (onDoubleClicked(FieldContainerPtr, UInt32,
00276                                             UInt32,            ButtonState)));
00277 
00278             QString s(pFC->getType().getFieldDescription(i+1)->getCName());
00279 
00280             if(pMFView->getFieldPtr()->getSize() >= 2)
00281             {
00282                 s += "\n";
00283 
00284                 QString num;
00285                 num.setNum(pMFView->getFieldPtr()->getSize());
00286                 s += num;
00287             }
00288             _pTable->setText(i, NameColumn, s);
00289         }
00290 
00291         _pTable->setText(i, TypeColumn,
00292                          pFC->getField(i+1)->getType().getCName());
00293     }
00294 
00295     for(UInt32 i=0; i<uiNumFields; ++i)
00296         _pTable->adjustRow(i);
00297 
00298     _pTable->adjustColumn(NameColumn );
00299     _pTable->adjustColumn(ValueColumn);
00300 
00301     if(_bShowTypeColumn)
00302     {
00303         _pTable->showColumn  (TypeColumn);
00304         _pTable->adjustColumn(TypeColumn);
00305     }
00306     else
00307     {
00308         _pTable->hideColumn(TypeColumn);
00309     }
00310 }


Member Data Documentation

QTable* osg::QFieldContainerView::_pTable [private]
 

Definition at line 135 of file OSGQFieldContainerView_qt.h.

Referenced by beginEdit(), clearTable(), endEdit(), fillTable(), QFieldContainerView(), resizeEvent(), and setShowTypeColumn().

FieldContainerPtr osg::QFieldContainerView::_pFC [private]
 

Definition at line 136 of file OSGQFieldContainerView_qt.h.

Referenced by beginEdit(), endEdit(), getFieldContainer(), and setFieldContainer().

UInt32 osg::QFieldContainerView::_uiAspect [private]
 

Definition at line 137 of file OSGQFieldContainerView_qt.h.

Referenced by getAspect(), setAspect(), and setFieldContainer().

bool osg::QFieldContainerView::_bShowTypeColumn [private]
 

Definition at line 139 of file OSGQFieldContainerView_qt.h.

Referenced by fillTable(), getShowTypeColumn(), and setShowTypeColumn().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:31:01 2005 for OpenSG by  doxygen 1.4.3