Commit b0066042 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - gui now uses WPropertyGroupBase for showing property group widgets

parent 40288d01
......@@ -852,18 +852,18 @@ void WQtControlPanel::setNewActiveModule( boost::shared_ptr< WModule > module )
}
}
WQtPropertyGroupWidget* WQtControlPanel::buildPropWidget( boost::shared_ptr< WProperties > props )
WQtPropertyGroupWidget* WQtControlPanel::buildPropWidget( WPropertyGroupBase::SPtr props )
{
WQtPropertyGroupWidget* tab = new WQtPropertyGroupWidget( props );
if( props.get() )
{
// read lock, gets unlocked upon destruction (out of scope)
WProperties::PropertySharedContainerType::ReadTicket propAccess = props->getProperties();
WPropertyGroupBase::PropertySharedContainerType::ReadTicket propAccess = props->getProperties();
tab->setName( QString::fromStdString( props->getName() ) );
// iterate all properties.
for( WProperties::PropertyConstIterator iter = propAccess->get().begin(); iter != propAccess->get().end(); ++iter )
for( WPropertyGroupBase::PropertyConstIterator iter = propAccess->get().begin(); iter != propAccess->get().end(); ++iter )
{
switch ( ( *iter )->getType() )
{
......@@ -895,7 +895,10 @@ WQtPropertyGroupWidget* WQtControlPanel::buildPropWidget( boost::shared_ptr< WP
tab->addProp( ( *iter )->toPropTrigger() );
break;
case PV_GROUP:
tab->addGroup( buildPropWidget( ( *iter )->toPropGroup() ) );
tab->addGroup( buildPropWidget( ( *iter )->toPropGroupBase() ) );
break;
case PV_STRUCT:
tab->addGroup( buildPropWidget( ( *iter )->toPropGroupBase() ) );
break;
case PV_MATRIX4X4:
tab->addProp( ( *iter )->toPropMatrix4X4() );
......
......@@ -396,11 +396,11 @@ private slots:
void buildPropTab( boost::shared_ptr< WProperties > props, boost::shared_ptr< WProperties > infoProps );
/**
* Method builds a widgets containing all properties in props. It recursively calls itself to build group widgets for WPropGroup properties.
* Method builds a widgets containing all properties in props. It recursively calls itself to build group widgets for WPropertyGroupBase properties.
*
* \param props the properties.
*/
WQtPropertyGroupWidget* buildPropWidget( boost::shared_ptr< WProperties > props );
WQtPropertyGroupWidget* buildPropWidget( WPropertyGroupBase::SPtr props );
/**
* function gets called when a change to a tree item, eg. check box status, occurs
......
......@@ -32,14 +32,14 @@
#include "../events/WEventTypes.h"
#include "../events/WPropertyChangedEvent.h"
#include "core/common/WProperties.h"
#include "core/common/WPropertyGroupBase.h"
#include "../WGuiConsts.h"
#include "WQtPropertyGroupWidget.h"
#include "WQtPropertyGroupWidget.moc"
WQtPropertyGroupWidget::WQtPropertyGroupWidget( WPropGroup group, QWidget* parent )
WQtPropertyGroupWidget::WQtPropertyGroupWidget( WPropertyGroupBase::SPtr group, QWidget* parent )
: QWidget( parent ),
m_name( group->getName().c_str() ),
m_numberOfWidgets( 0 ),
......@@ -58,8 +58,8 @@ WQtPropertyGroupWidget::WQtPropertyGroupWidget( WPropGroup group, QWidget* paren
m_pageLayout->addLayout( m_controlLayout );
// empty groups are hidden too
// NOTE: the WProperties class fires the update condition if a prop gets added. So it automatically un-hides if a prop is added.
WProperties::PropertySharedContainerType::ReadTicket r = m_group->getReadTicket();
// NOTE: the WPropertyGroupBase class fires the update condition if a prop gets added. So it automatically un-hides if a prop is added.
WPropertyGroupBase::PropertySharedContainerType::ReadTicket r = m_group->getReadTicket();
bool hide = ( r->get().empty() | m_group->isHidden() );
r.reset();
// NOTE: a simple setHidden( group->isHidden() ) causes the QWidgets to popup if hidden is false. This is why we set hidden only if it really
......@@ -88,7 +88,7 @@ bool WQtPropertyGroupWidget::event( QEvent* event )
// a property changed
if( event->type() == WQT_PROPERTY_CHANGED_EVENT )
{
WProperties::PropertySharedContainerType::ReadTicket r = m_group->getReadTicket();
WPropertyGroupBase::PropertySharedContainerType::ReadTicket r = m_group->getReadTicket();
setHidden( r->get().empty() | m_group->isHidden() );
emit hideSignal( m_group->isHidden() );
return true;
......
......@@ -57,7 +57,7 @@ public:
* \param group The group
* \param parent The widget managing this widget
*/
WQtPropertyGroupWidget( WPropGroup group, QWidget* parent = 0 );
WQtPropertyGroupWidget( WPropertyGroupBase::SPtr group, QWidget* parent = 0 );
/**
* destructor
......@@ -258,7 +258,7 @@ private:
/**
* The property group handled here.
*/
WPropGroup m_group;
WPropertyGroupBase::SPtr m_group;
/**
* The connection for propertyChangeNotifier().
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment