Commit fb4df33f authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[FIX #236] roi properties where cleared immediatly after selecting the roi. This is fixed now.

parent f546095b
......@@ -166,6 +166,7 @@ WQtControlPanel::WQtControlPanel( WMainWindow* parent )
m_roiTreeWidget->setDropIndicatorShown( true );
m_roiTreeWidget->setDragDropMode( QAbstractItemView::InternalMove );
m_roiDock->setWidget( m_roiTreeWidget );
m_roiTreeWidget->setSelectionMode( QAbstractItemView::SingleSelection );
m_moduleExcluder = new WQtModuleConfig( parent );
connect( m_missingModuleAction, SIGNAL( triggered( bool ) ), m_moduleExcluder, SLOT( configure() ) );
......@@ -211,8 +212,8 @@ void WQtControlPanel::connectSlots()
connect( m_moduleTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( selectTreeItem() ) );
connect( m_moduleTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), this, SLOT( changeTreeItem( QTreeWidgetItem*, int ) ) );
connect( m_moduleTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), m_roiTreeWidget, SLOT( clearSelection() ) );
connect( m_roiTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), this, SLOT( selectRoiTreeItem() ) );
connect( m_roiTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), m_moduleTreeWidget, SLOT( clearSelection() ) );
connect( m_roiTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), this, SLOT( selectRoiTreeItem( QTreeWidgetItem* ) ) );
connect( m_colormapper, SIGNAL( textureSelectionChanged( osg::ref_ptr< WGETexture3D > ) ),
this, SLOT( selectDataModule( osg::ref_ptr< WGETexture3D > ) ) );
connect( m_roiTreeWidget, SIGNAL( dragDrop() ), this, SLOT( handleRoiDragDrop() ) );
......@@ -611,8 +612,9 @@ void WQtControlPanel::addRoi( osg::ref_ptr< WROI > roi )
branchItem->setExpanded( true );
newItem = branchItem->addRoiItem( roi );
newItem->setDisabled( false );
newItem->setSelected( true );
m_roiTreeWidget->setCurrentItem( newItem );
WKernel::getRunningKernel()->getRoiManager()->setSelectedRoi( getSelectedRoi() );
selectRoiTreeItem( newItem );
}
void WQtControlPanel::removeRoi( osg::ref_ptr< WROI > roi )
......@@ -703,12 +705,11 @@ void WQtControlPanel::selectTreeItem()
}
}
void WQtControlPanel::selectRoiTreeItem()
void WQtControlPanel::selectRoiTreeItem( QTreeWidgetItem* item )
{
clearAndDeleteTabs();
// Make compatibles toolbar empty
{
if( m_mainWindow->getCompatiblesToolbar() != 0 )
{
m_mainWindow->getCompatiblesToolbar()->makeEmpty();
......@@ -717,14 +718,15 @@ void WQtControlPanel::selectRoiTreeItem()
{
m_mainWindow->setCompatiblesToolbar( new WQtCombinerToolbar( m_mainWindow ) );
}
}
boost::shared_ptr< WModule > module;
boost::shared_ptr< WProperties > props;
if( m_roiTreeWidget->selectedItems().size() != 0 )
{
switch( m_roiTreeWidget->selectedItems().at( 0 )->type() )
// activate the item
m_roiTreeWidget->setCurrentItem( item );
// what kind of item is it?
switch( item->type() )
{
case SUBJECT:
case DATASET:
......@@ -734,23 +736,17 @@ void WQtControlPanel::selectRoiTreeItem()
WKernel::getRunningKernel()->getRoiManager()->setSelectedRoi( getSelectedRoi() );
break;
case ROIBRANCH:
props = ( static_cast< WQtBranchTreeItem* >( m_roiTreeWidget->selectedItems().at( 0 ) ) )->getBranch()->getProperties();
props = ( static_cast< WQtBranchTreeItem* >( item ) )->getBranch()->getProperties();
WKernel::getRunningKernel()->getRoiManager()->setSelectedRoi( getFirstRoiInSelectedBranch() );
break;
case ROI:
props = ( static_cast< WQtRoiTreeItem* >( m_roiTreeWidget->selectedItems().at( 0 ) ) )->getRoi()->getProperties();
props = ( static_cast< WQtRoiTreeItem* >( item ) )->getRoi()->getProperties();
props->getProperty( "active" )->toPropBool()->set( item->checkState( 0 ) );
WKernel::getRunningKernel()->getRoiManager()->setSelectedRoi( getSelectedRoi() );
break;
default:
break;
}
}
if( m_roiTreeWidget->selectedItems().size() == 1 && m_roiTreeWidget->selectedItems().at( 0 )->type() == ROI )
{
osg::ref_ptr< WROI > roi = ( static_cast< WQtRoiTreeItem* >( m_roiTreeWidget->selectedItems().at( 0 ) ) )->getRoi();
roi->getProperties()->getProperty( "active" )->toPropBool()->set( m_roiTreeWidget->selectedItems().at( 0 )->checkState( 0 ) );
}
buildPropTab( props, boost::shared_ptr< WProperties >() );
}
......
......@@ -405,8 +405,10 @@ private slots:
/**
* function that gets called when a tree item is selected, on a new select that tab widget
* is rebuilt with the controls provided by the tree item
*
* \param item the item that has been clicked
*/
void selectRoiTreeItem();
void selectRoiTreeItem( QTreeWidgetItem* item );
/**
* Will be called to select the data module for the given texture.
......
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