INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

shortcutkeymanager.h

00001 #ifndef HYDROQGUI_SHORTCUTKEYMANAGER_H
00002 #define HYDROQGUI_SHORTCUTKEYMANAGER_H
00003 
00004 #include <QWidget>
00005 #include <QAction>
00006 #include <QKeySequence>
00007 #include <hydroutil/uncopyable.h>
00008 
00009 namespace hydroqguielementutil {
00010 
00011 namespace detail {
00012     class ShortcutKey;
00013 }
00014 
00027 class ShortcutKeyManager : public hydroutil::Uncopyable
00028 {
00029 
00030 public: 
00031 
00032     ShortcutKeyManager( QWidget *mainWidget );
00033 
00034     ~ShortcutKeyManager();
00035 
00040     void subscribeToShortcutKey( QAction      *elementAction,
00041                                  QKeySequence  key,
00042                                  bool          ownExclusively,
00043                                  QObject      *triggeree  );
00044 
00046     void unsubscribeFromShortcutKey( QKeySequence  key,
00047                                      QObject      *triggeree );
00048 
00049 private: 
00050 
00051     // list of shorcut actions
00052     QList<detail::ShortcutKey*> shortcutKeys_;
00053 
00054     QWidget       *mainWidget_;
00055 };
00056 
00060 class ShortcutKeyReservation {
00061 public:
00062     ShortcutKeyReservation( QAction            *elementAction,
00063                             QKeySequence        key,
00064                             bool                ownExclusively,
00065                             QObject            *trigeree,
00066                             ShortcutKeyManager &shortcutKeyManager )
00067         : key_(key),
00068           trigeree_(trigeree),
00069           shortcutKeyManager_(shortcutKeyManager)
00070         {
00071             shortcutKeyManager_.subscribeToShortcutKey(elementAction,
00072                                                        key,
00073                                                        ownExclusively,
00074                                                        trigeree);
00075         }
00076     ~ShortcutKeyReservation()
00077         {
00078             shortcutKeyManager_.unsubscribeFromShortcutKey( key_, trigeree_ );
00079         }
00080 private:
00081     QKeySequence        key_;
00082     QObject            *trigeree_;
00083     ShortcutKeyManager &shortcutKeyManager_;
00084 };
00085 
00086 }
00087 
00088 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5