osg::QSFieldView Class Reference

The QT Widget to display an OpenSG SField.

#include <OSGQFieldView_qt.h>

Inheritance diagram for osg::QSFieldView:

osg::QFieldViewBase

List of all members.

Public Slots

virtual void beginEdit (UInt32 uiIndex)
virtual void endEdit (void)

Signals

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

Public Member Functions

 QSFieldView (FieldContainerPtr pFC, UInt32 uiFieldId, UInt32 uiAspect, QWidget *parent, const char *name=NULL)
virtual ~QSFieldView (void)
virtual void setAll (FieldContainerPtr pFC, UInt32 uiFieldId, UInt32 uiAspect)
virtual void setFieldContainer (FieldContainerPtr pFC)
virtual void setFieldId (UInt32 uiFieldId)
virtual void setAspect (UInt32 uiAspect)
virtual QSize sizeHint (void) const
virtual QSize minimumSizeHint (void) const
virtual QSizePolicy sizePolicy (void) const
FieldContainerPtrgetFieldContainer (void)
const FieldContainerPtrgetFieldContainer (void) const
UInt32 getFieldId (void) const
UInt32 getAspect (void) const
FieldgetFieldPtr (void)
const FieldgetFieldPtr (void) const

Protected Slots

virtual void onEditorDone (void)
virtual void onFieldUpdated (UInt32 uiIndex)

Protected Member Functions

virtual void mousePressEvent (QMouseEvent *pEvent)
virtual void mouseDoubleClickEvent (QMouseEvent *pEvent)
virtual void paintEvent (QPaintEvent *pEvent)
virtual void resizeEvent (QResizeEvent *pEvent)

Private Types

typedef QFieldViewBase Inherited

Private Member Functions

void initSelf (void)

Private Attributes

QFieldValueLabelBase_pLabel
QFieldEditorBase_pEditor


Detailed Description

Definition at line 127 of file OSGQFieldView_qt.h.


Member Typedef Documentation

Reimplemented from osg::QFieldViewBase.

Definition at line 165 of file OSGQFieldView_qt.h.


Constructor & Destructor Documentation

QSFieldView::QSFieldView ( FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiAspect,
QWidget *  parent,
const char *  name = NULL 
)

Definition at line 117 of file OSGQFieldView_qt.cpp.

References initSelf().

00121     : Inherited(pFC, uiFieldId, uiAspect, parent, name),
00122       _pLabel  (NULL                                  ),
00123       _pEditor (NULL                                  )
00124 {
00125     setBackgroundMode(NoBackground);
00126 
00127     initSelf();
00128 }

QSFieldView::~QSFieldView ( void   )  [virtual]

Definition at line 130 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, and endEdit().

00131 {
00132     endEdit();
00133 
00134     delete _pLabel;
00135     delete _pEditor;
00136 }


Member Function Documentation

void QSFieldView::setAll ( FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiAspect 
) [virtual]

Reimplemented from osg::QFieldViewBase.

Definition at line 139 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, endEdit(), initSelf(), and osg::QFieldViewBase::setAll().

00140 {
00141     endEdit();
00142 
00143     delete _pLabel;
00144     delete _pEditor;
00145 
00146     Inherited::setAll(pFC, uiFieldId, uiAspect);
00147 
00148     initSelf();
00149 }

void QSFieldView::setFieldContainer ( FieldContainerPtr  pFC  )  [virtual]

Reimplemented from osg::QFieldViewBase.

Definition at line 152 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, endEdit(), osg::QFieldViewBase::getFieldContainer(), initSelf(), and osg::QFieldViewBase::setFieldContainer().

00153 {
00154     if(pFC == getFieldContainer())
00155         return;
00156 
00157     endEdit();
00158 
00159     delete _pLabel;
00160     delete _pEditor;
00161 
00162     Inherited::setFieldContainer(pFC);
00163 
00164     initSelf();
00165 }

void QSFieldView::setFieldId ( UInt32  uiFieldId  )  [virtual]

Reimplemented from osg::QFieldViewBase.

Definition at line 168 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, endEdit(), osg::QFieldViewBase::getFieldId(), initSelf(), and osg::QFieldViewBase::setFieldId().

00169 {
00170     if(uiFieldId == getFieldId())
00171         return;
00172 
00173     endEdit();
00174 
00175     delete _pLabel;
00176     delete _pEditor;
00177 
00178     Inherited::setFieldId(uiFieldId);
00179 
00180     initSelf();
00181 }

void QSFieldView::setAspect ( UInt32  uiAspect  )  [virtual]

Reimplemented from osg::QFieldViewBase.

Definition at line 184 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, endEdit(), osg::QFieldViewBase::getAspect(), initSelf(), and osg::QFieldViewBase::setAspect().

00185 {
00186     if(uiAspect == getAspect())
00187         return;
00188 
00189     endEdit();
00190 
00191     delete _pLabel;
00192     delete _pEditor;
00193 
00194     Inherited::setAspect(uiAspect);
00195 
00196     initSelf();
00197 }

QSize QSFieldView::sizeHint ( void   )  const [virtual]

Implements osg::QFieldViewBase.

Definition at line 200 of file OSGQFieldView_qt.cpp.

References _pLabel, and osg::QFieldValueLabelBase::sizeHint().

00201 {
00202     return _pLabel->sizeHint();
00203 }

QSize QSFieldView::minimumSizeHint ( void   )  const [virtual]

Implements osg::QFieldViewBase.

Definition at line 206 of file OSGQFieldView_qt.cpp.

References _pLabel, and osg::QFieldValueLabelBase::minimumSizeHint().

00207 {
00208     return _pLabel->minimumSizeHint();
00209 }

QSizePolicy QSFieldView::sizePolicy ( void   )  const [virtual]

Implements osg::QFieldViewBase.

Definition at line 212 of file OSGQFieldView_qt.cpp.

00213 {
00214     return QSizePolicy(QSizePolicy::MinimumExpanding, 
00215                        QSizePolicy::Fixed            );
00216 }

void QSFieldView::beginEdit ( UInt32  uiIndex  )  [virtual, slot]

Implements osg::QFieldViewBase.

Definition at line 219 of file OSGQFieldView_qt.cpp.

References _pEditor, osg::QFieldEditorBase::activate(), endEdit(), and osg::QFieldEditorBase::setIndex().

00220 {
00221     if(uiIndex != 0)
00222         return;
00223 
00224     endEdit();
00225 
00226     _pEditor->setIndex(uiIndex);
00227     _pEditor->activate(       );
00228 
00229     update();
00230 }

void QSFieldView::endEdit ( void   )  [virtual, slot]

void QSFieldView::mousePressEvent ( QMouseEvent *  pEvent  )  [protected, virtual]

Definition at line 242 of file OSGQFieldView_qt.cpp.

References osg::QFieldViewBase::clicked(), osg::QFieldViewBase::getFieldContainer(), and osg::QFieldViewBase::getFieldId().

00243 {
00244     emit clicked(getFieldContainer(), getFieldId(), 0, pEvent->button());
00245 }

void QSFieldView::mouseDoubleClickEvent ( QMouseEvent *  pEvent  )  [protected, virtual]

void QSFieldView::paintEvent ( QPaintEvent *  pEvent  )  [protected, virtual]

Implements osg::QFieldViewBase.

Definition at line 266 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, osg::QFieldEditorBase::getActive(), and osg::QFieldValueLabelBase::paint().

00267 {
00268     if(_pEditor && _pEditor->getActive())
00269         return;
00270 
00271     QPainter painter;
00272     QRect    rectSelf = rect();
00273 
00274     painter.begin(this);
00275 
00276     painter.setClipRect(rectSelf.intersect(pEvent->rect()));
00277 
00278     _pLabel->paint(&painter, palette().active(), rectSelf);
00279 
00280     painter.end();
00281 }

void QSFieldView::resizeEvent ( QResizeEvent *  pEvent  )  [protected, virtual]

Definition at line 284 of file OSGQFieldView_qt.cpp.

References _pEditor.

00285 {
00286     if(_pEditor)
00287         _pEditor->resize(pEvent->size());
00288 }

void QSFieldView::onEditorDone ( void   )  [protected, virtual, slot]

Implements osg::QFieldViewBase.

Definition at line 254 of file OSGQFieldView_qt.cpp.

References endEdit().

Referenced by initSelf().

00255 {
00256     endEdit();
00257 }

void QSFieldView::onFieldUpdated ( UInt32  uiIndex  )  [protected, virtual, slot]

Implements osg::QFieldViewBase.

Definition at line 260 of file OSGQFieldView_qt.cpp.

References _pLabel, and osg::QFieldValueLabelBase::valueChanged().

Referenced by initSelf().

00261 {
00262     _pLabel->valueChanged();
00263 }

void QSFieldView::initSelf ( void   )  [private]

Definition at line 291 of file OSGQFieldView_qt.cpp.

References _pEditor, _pLabel, osg::QFieldEditorFactory::createEditor(), osg::QFieldLabelFactory::createLabel(), onEditorDone(), onFieldUpdated(), osg::QFieldEditorFactory::the(), and osg::QFieldLabelFactory::the().

Referenced by QSFieldView(), setAll(), setAspect(), setFieldContainer(), and setFieldId().

00292 {
00293     _pLabel  = QFieldLabelFactory::the().createLabel  (this, 0);
00294     _pEditor = QFieldEditorFactory::the().createEditor(
00295         0, this, "QSFieldView::_pEditor");
00296 
00297     connect(_pEditor, SIGNAL(editorDone    (void  )),
00298             this,     SLOT  (onEditorDone  (void  )));
00299 
00300     connect(_pEditor, SIGNAL(fieldUpdated  (UInt32)),
00301             this,     SLOT  (onFieldUpdated(UInt32)));
00302 }

FieldContainerPtr & osg::QFieldViewBase::getFieldContainer ( void   )  [inline, inherited]

const FieldContainerPtr & osg::QFieldViewBase::getFieldContainer ( void   )  const [inline, inherited]

Definition at line 50 of file OSGQFieldView_qt.inl.

References osg::QFieldViewBase::_pFieldCon.

00051 {
00052     return _pFieldCon;
00053 }

UInt32 osg::QFieldViewBase::getFieldId ( void   )  const [inline, inherited]

UInt32 osg::QFieldViewBase::getAspect ( void   )  const [inline, inherited]

Definition at line 62 of file OSGQFieldView_qt.inl.

References osg::QFieldViewBase::_uiAspect.

Referenced by osg::QFieldValueLabelBase::getAspect(), osg::QMFieldView::setAspect(), and setAspect().

00063 {
00064     return _uiAspect;
00065 }

Field * osg::QFieldViewBase::getFieldPtr ( void   )  [inline, inherited]

const Field * osg::QFieldViewBase::getFieldPtr ( void   )  const [inline, inherited]

Definition at line 76 of file OSGQFieldView_qt.inl.

References osg::QFieldViewBase::_pFieldCon, osg::QFieldViewBase::_uiAspect, osg::QFieldViewBase::_uiFieldId, osg::FieldContainerPtrBase::getAspectCPtr(), and osg::FieldContainer::getField().

00077 {
00078     FieldContainer *pFCAsp = _pFieldCon.getAspectCPtr(_uiAspect);
00079 
00080     return pFCAsp->getField(_uiFieldId);
00081 }

void osg::QFieldViewBase::clicked ( FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiIndex,
ButtonState  button 
) [signal, inherited]

void osg::QFieldViewBase::doubleClicked ( FieldContainerPtr  pFC,
UInt32  uiFieldId,
UInt32  uiIndex,
ButtonState  button 
) [signal, inherited]


Member Data Documentation


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

Generated on Mon Mar 17 12:26:12 2008 for OpenSG by  doxygen 1.5.5