Commit 57e32368 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - empty property tabs do not get displayed.

parent 682bc879
......@@ -39,7 +39,7 @@ WPropertyIntWidget::WPropertyIntWidget( WPropInt property, QGridLayout* property
m_intProperty( property ),
m_slider( Qt::Horizontal, this ),
m_edit( this ),
m_layout()
m_layout( this )
{
// initialize members
m_edit.resize( m_edit.minimumSizeHint().width() , m_edit.size().height() );
......
......@@ -36,12 +36,12 @@ WPropertyStringWidget::WPropertyStringWidget( WPropString property, QGridLayout*
WPropertyWidget( property, propertyGrid, parent ),
m_stringProperty( property ),
m_edit( this ),
m_layout()
m_layout( this )
{
// initialize members
setLayout( &m_layout );
// layout both against each other
// layout
m_layout.addWidget( &m_edit );
// set the initial values
......
......@@ -32,7 +32,8 @@ WQtDSBWidget::WQtDSBWidget( std::string name, QWidget* parent )
: QWidget( parent ),
m_name( name.c_str() ),
m_controlLayout(),
m_pageLayout()
m_pageLayout(),
m_numberOfWidgets( 0 )
{
m_pageLayout.addLayout( &m_controlLayout );
}
......@@ -43,41 +44,57 @@ WQtDSBWidget::~WQtDSBWidget()
WPropertyBoolWidget* WQtDSBWidget::addProp( WPropBool property )
{
++m_numberOfWidgets;
return new WPropertyBoolWidget( property, &m_controlLayout, this );
}
WPropertyIntWidget* WQtDSBWidget::addProp( WPropInt property )
{
++m_numberOfWidgets;
return new WPropertyIntWidget( property, &m_controlLayout, this );
}
WPropertyDoubleWidget* WQtDSBWidget::addProp( WPropDouble property )
{
++m_numberOfWidgets;
return new WPropertyDoubleWidget( property, &m_controlLayout, this );
}
WPropertyStringWidget* WQtDSBWidget::addProp( WPropString property )
{
++m_numberOfWidgets;
return new WPropertyStringWidget( property, &m_controlLayout, this );
}
WPropertyColorWidget* WQtDSBWidget::addProp( WPropColor property )
{
++m_numberOfWidgets;
return new WPropertyColorWidget( property, &m_controlLayout, this );
}
WPropertyFilenameWidget* WQtDSBWidget::addProp( WPropFilename property )
{
++m_numberOfWidgets;
return new WPropertyFilenameWidget( property, &m_controlLayout, this );
}
WPropertyTriggerWidget* WQtDSBWidget::addProp( WPropTrigger property )
{
++m_numberOfWidgets;
return new WPropertyTriggerWidget( property, &m_controlLayout, this );
}
void WQtDSBWidget::addGroup( WQtDSBWidget* widget )
{
++m_numberOfWidgets;
// TODO(ebaum): extend it to collapse the group
QGroupBox* group = new QGroupBox( widget->getName() , this );
QGridLayout* grid = new QGridLayout();
......@@ -105,3 +122,7 @@ void WQtDSBWidget::setName( QString name )
m_name = name;
}
bool WQtDSBWidget::isEmpty() const
{
return !m_numberOfWidgets;
}
......@@ -60,6 +60,13 @@ public:
*/
virtual ~WQtDSBWidget();
/**
* True if there are no widgets inside.
*
* \return true if number of widgets is 0.
*/
bool isEmpty() const;
/**
* helper function to add a generic button
* \param label Text on the push button
......@@ -188,6 +195,11 @@ private:
* Layout used for the whole widget.
*/
QVBoxLayout m_pageLayout;
/**
* The number of widgets inside this one.
*/
unsigned int m_numberOfWidgets;
};
#endif // WQTDSBWIDGET_H
......@@ -426,7 +426,7 @@ void WQtDatasetBrowser::selectRoiTreeItem()
WQtDSBWidget* WQtDatasetBrowser::buildPropWidget( boost::shared_ptr< WProperties > props )
{
WQtDSBWidget* tab = new WQtDSBWidget( QString::fromStdString( props->getName() ) );
WQtDSBWidget* tab = new WQtDSBWidget( props->getName() );
if ( props.get() )
{
......@@ -563,10 +563,9 @@ void WQtDatasetBrowser::changeRoiTreeItem()
}
}
int WQtDatasetBrowser::addTabWidgetContent( WQtDSBWidget* content )
{
if ( !content )
if ( !content || content->isEmpty() )
{
return -1;
}
......
......@@ -235,6 +235,7 @@ void WMTemplate::properties()
// TODO(ebaum): write
m_aIntegerOutput = m_infoProperties->addProperty( "Run Count", "Number of run cycles the module made so far.", 0 );
m_aIntegerOutput->setPurpose( PV_PURPOSE_INFORMATION );
}
void WMTemplate::moduleMain()
......
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