Commit a9a1abb7 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD] shortcuts for removing ROIs and modules can now be configured through

the walnut.cfg. Defaults are "Del" and "Backspace" even if no configuration is given.

Note that the keys can not be equal by now (or at least is seems so) because
Qt otherwise complains about doubly mapped keys
parent c07d1aaf
......@@ -55,6 +55,14 @@ compatiblesToolBarPos = 0 # position of the compatibles toolbar (overrides toolB
# dsbInvisibleByDefault = yes # hide the control panel on startup. Can be shown using F9.
# dsbFloatingByDefault = yes # should the control panel be undocked on startup?
# Here you can put any key sequence you would like to result in removing modules or ROIs
# Examples:
# deleteKey = Backspace
# deleteKey = Ctrl+J
# deleteKey = B
deleteModuleKey = Backspace
deleteROIKey = Del
####################################################################
# Other GUI settings
......
......@@ -58,6 +58,14 @@ compatiblesToolBarPos = 0 # position of the compatibles toolbar (overrides toolB
# dsbInvisibleByDefault = yes # hide the control panel on startup. Can be shown using F9.
# dsbFloatingByDefault = yes # should the control panel be undocked on startup?
# Here you can put any key sequence you would like to result in removing modules or ROIs
# Examples:
# deleteKey = Backspace
# deleteKey = Ctrl+J
# deleteKey = B
deleteModuleKey = Backspace
deleteROIKey = Del
####################################################################
# Other GUI settings
......
......@@ -91,7 +91,17 @@ WQtControlPanel::WQtControlPanel( WMainWindow* parent )
m_moduleTreeWidget->addAction( separator );
m_deleteModuleAction = new QAction( WQt4Gui::getMainWindow()->getIconManager()->getIcon( "remove" ), "Remove Module", m_moduleTreeWidget );
m_deleteModuleAction->setShortcut( QKeySequence( Qt::Key_Backspace ) );
{
// Set the key for removing modules
std::string deleteKey = "";
WPreferences::getPreference( "qt4gui.deleteModuleKey", &deleteKey );
if( deleteKey == "" )
{
deleteKey = "Backspace";
}
m_deleteModuleAction->setShortcut( QKeySequence( QString::fromStdString( deleteKey ) ) );
}
connect( m_deleteModuleAction, SIGNAL( triggered() ), this, SLOT( deleteModuleTreeItem() ) );
m_moduleTreeWidget->addAction( m_deleteModuleAction );
......@@ -147,8 +157,17 @@ WQtControlPanel::WQtControlPanel( WMainWindow* parent )
connectSlots();
QShortcut* shortcut = new QShortcut( QKeySequence( Qt::Key_Delete ), m_roiTreeWidget );
connect( shortcut, SIGNAL( activated() ), this, SLOT( deleteROITreeItem() ) );
{
// Set the key for removing ROIs and connect the event
std::string deleteKey = "";
WPreferences::getPreference( "qt4gui.deleteROIKey", &deleteKey );
if( deleteKey == "" )
{
deleteKey = "Delete";
}
QShortcut* shortcut = new QShortcut( QKeySequence( QString::fromStdString( deleteKey ) ), m_roiTreeWidget );
connect( shortcut, SIGNAL( activated() ), this, SLOT( deleteROITreeItem() ) );
}
}
WQtControlPanel::~WQtControlPanel()
......
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