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

[ADD #256] ROI dock now provides add/del actions in its titlebar

parent d21cf4a2
......@@ -289,7 +289,7 @@ void WMainWindow::setupGUI()
connect( m_saveAction, SIGNAL( triggered( bool ) ), this, SLOT( projectSaveAll() ) );
m_loadButton->setToolTip( "Load a dataset or project from file" );
roiButton->setToolTip( "Create new ROI" );
roiButton->setToolTip( "Insert a new ROI" );
m_saveAction->setToolTip( "Save current project to file" );
// we want the upper most tree item to be selected. This helps to make the always compatible modules
......@@ -442,6 +442,10 @@ void WMainWindow::setupGUI()
// allow the control panel to complete setup
m_controlPanel->completeGuiSetup();
// add the roi actions to roi dock title
m_controlPanel->getRoiDock()->addTitleAction( roiButton );
m_controlPanel->getRoiDock()->addTitleAction( m_controlPanel->getRoiDeleteAction() );
// after creating the GUI, restore its saved state
restoreSavedState();
}
......
......@@ -201,13 +201,14 @@ WQtControlPanel::WQtControlPanel( WMainWindow* parent )
connectSlots();
// similar to the module delete action: a ROI delete action
m_deleteRoiAction = new QAction( WQt4Gui::getMainWindow()->getIconManager()->getIcon( "remove" ), "Remove ROI", m_roiTreeWidget );
m_deleteRoiAction = new QAction( WQt4Gui::getMainWindow()->getIconManager()->getIcon( "del_roi" ), "Remove ROI", m_roiTreeWidget );
{
// Set the key for removing modules
m_deleteRoiAction->setShortcutContext( Qt::WidgetShortcut );
m_deleteRoiAction->setShortcut( QKeySequence::Delete );
m_deleteRoiAction->setIconVisibleInMenu( true );
}
m_deleteRoiAction->setEnabled( false );
connect( m_deleteRoiAction, SIGNAL( triggered() ), this, SLOT( deleteROITreeItem() ) );
m_roiTreeWidget->addAction( m_deleteModuleAction );
m_roiTreeWidget->addAction( m_deleteRoiAction );
......@@ -222,6 +223,11 @@ void WQtControlPanel::completeGuiSetup()
m_mainWindow->addGlobalMenu( m_mainWindow->getNetworkEditor()->getView() );
}
QAction* WQtControlPanel::getRoiDeleteAction() const
{
return m_deleteRoiAction;
}
void WQtControlPanel::connectSlots()
{
// if the user changes some white/blacklist setting: update.
......@@ -742,6 +748,9 @@ void WQtControlPanel::selectRoiTreeItem( QTreeWidgetItem* item )
// activate the item
m_roiTreeWidget->setCurrentItem( item );
// delete is disabled by default
m_deleteRoiAction->setEnabled( false );
// what kind of item is it?
switch( item->type() )
{
......@@ -760,6 +769,7 @@ void WQtControlPanel::selectRoiTreeItem( QTreeWidgetItem* item )
props = ( static_cast< WQtRoiTreeItem* >( item ) )->getRoi()->getProperties();
props->getProperty( "active" )->toPropBool()->set( item->checkState( 0 ) );
WKernel::getRunningKernel()->getRoiManager()->setSelectedRoi( getSelectedRoi() );
m_deleteRoiAction->setEnabled( true );
break;
default:
break;
......
......@@ -177,6 +177,13 @@ public:
*/
WQtDockWidget* getRoiDock() const;
/**
* Return the action to delete a selected roi
*
* \return the action
*/
QAction* getRoiDeleteAction() const;
/**
* Gets the module dock widget.
*
......
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