Commit a545d098 authored by Jan Möbius's avatar Jan Möbius
Browse files

Documentation and moved key registration code for core to keyhandling file

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4277 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 29e398c7
...@@ -337,13 +337,8 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -337,13 +337,8 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
statusBar_->showMessage("Ready", 5000); statusBar_->showMessage("Ready", 5000);
//register keys for coreWidget registerCoreKeys();
connect(this,SIGNAL( registerKey(int, Qt::KeyboardModifiers, QString) ),
this,SLOT(slotRegisterKey(int, Qt::KeyboardModifiers, QString)) );
emit registerKey(Qt::Key_S,Qt::ControlModifier, "Save Object");
emit registerKey(Qt::Key_O,Qt::ControlModifier, "Open Object");
emit registerKey(Qt::Key_Escape,Qt::NoModifier, "Switch to last action mode ( Move,Picking,Light or Info Mode)");
} }
......
...@@ -159,15 +159,21 @@ public: ...@@ -159,15 +159,21 @@ public:
virtual void keyReleaseEvent(QKeyEvent* _e); virtual void keyReleaseEvent(QKeyEvent* _e);
signals : signals :
/// When this Signal is emitted when a Keyevent Event occures
void PluginKeyEvent(QKeyEvent* );
/// When this Signal is emitted when a key release event event occures /** When this Signal is emitted when a Keyevent Event occures
void PluginKeyReleaseEvent(QKeyEvent* ); * The signal is connected to all Plugins implementing KeyInterface by the pluginLoader
*/
void PluginKeyEvent(QKeyEvent* );
/** When this Signal is emitted when a Keyevent Release occures
* The signal is connected to all Plugins implementing KeyInterface by the pluginLoader
*/
void PluginKeyReleaseEvent(QKeyEvent* );
/// internal signal to register CoreWidget keys
void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse = false);
/// internal signal to register CoreWidget keys
void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse = false);
private: private:
///typedefs ///typedefs
...@@ -177,6 +183,9 @@ public: ...@@ -177,6 +183,9 @@ public:
typedef std::pair< KeyMap::iterator, KeyMap::iterator > KeyRange; typedef std::pair< KeyMap::iterator, KeyMap::iterator > KeyRange;
/// This function registers all keys for the core
void coreKeyPressEvent();
/// Handle core key events /// Handle core key events
void coreKeyPressEvent (QKeyEvent* _e); void coreKeyPressEvent (QKeyEvent* _e);
void coreKeyReleaseEvent(QKeyEvent* _e); void coreKeyReleaseEvent(QKeyEvent* _e);
......
...@@ -221,7 +221,7 @@ void CoreWidget::slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, Q ...@@ -221,7 +221,7 @@ void CoreWidget::slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, Q
emit log(LOGERR, "Could not add key mapping. Key already assigned to the core."); emit log(LOGERR, "Could not add key mapping. Key already assigned to the core.");
else{ else{
BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin); BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
if (basePlugin) if (basePlugin)
emit log(LOGERR, "Could not add key mapping. Key already assigned to " + basePlugin->name() ); emit log(LOGERR, "Could not add key mapping. Key already assigned to " + basePlugin->name() );
else else
...@@ -252,6 +252,19 @@ void CoreWidget::slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, Q ...@@ -252,6 +252,19 @@ void CoreWidget::slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, Q
} }
/// if a keyPressEvent belongs to the core this functions is called
void CoreWidget::coreKeyPressEvent {
//register keys for coreWidget
connect(this , SIGNAL( registerKey(int, Qt::KeyboardModifiers, QString) ),
this , SLOT(slotRegisterKey(int, Qt::KeyboardModifiers, QString)) );
emit registerKey(Qt::Key_S , Qt::ControlModifier, "Save Object");
emit registerKey(Qt::Key_O , Qt::ControlModifier, "Open Object");
emit registerKey(Qt::Key_Escape , Qt::NoModifier, "Switch to last action mode ( Move,Picking,Light or Info Mode)");
}
/// if a keyPressEvent belongs to the core this functions is called /// if a keyPressEvent belongs to the core this functions is called
void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){ void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){
......
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