author | zecke <zecke> | 2004-03-29 01:17:56 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-29 01:17:56 (UTC) |
commit | 28648c47d06c339ee893f8cef740bae9d54863bf (patch) (unidiff) | |
tree | df9b02dfca6f64cb017c5225a3730336d3ea3fdb | |
parent | 3af77639ad7a1f5acf66220fe493df424e40f949 (diff) | |
download | opie-28648c47d06c339ee893f8cef740bae9d54863bf.zip opie-28648c47d06c339ee893f8cef740bae9d54863bf.tar.gz opie-28648c47d06c339ee893f8cef740bae9d54863bf.tar.bz2 |
One more keyboard action
-rw-r--r-- | libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp index 329df09..5553166 100644 --- a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp +++ b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp | |||
@@ -81,37 +81,41 @@ TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl ) | |||
81 | blackList.append( Opie::Ui::OKeyPair::upArrowKey() ); | 81 | blackList.append( Opie::Ui::OKeyPair::upArrowKey() ); |
82 | 82 | ||
83 | m_manager = new Opie::Ui::OKeyConfigManager( m_config, "Key Group", | 83 | m_manager = new Opie::Ui::OKeyConfigManager( m_config, "Key Group", |
84 | blackList, false, this, "Key Manager" ); | 84 | blackList, false, this, "Key Manager" ); |
85 | 85 | ||
86 | m_manager->addKeyConfig( Opie::Ui::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), | 86 | m_manager->addKeyConfig( Opie::Ui::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), |
87 | 10, Opie::Ui::OKeyPair( Qt::Key_D, 0 ), this, | 87 | 10, Opie::Ui::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, |
88 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); | 88 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); |
89 | m_manager->addKeyConfig( Opie::Ui::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), | ||
90 | 11, Opie::Ui::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); | ||
89 | 91 | ||
90 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&)), | 92 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Ui::OKeyConfigItem&)), |
91 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Ui::OKeyConfigItem&)) ); | 93 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Ui::OKeyConfigItem&)) ); |
92 | // when commenting the line below out the keyPressEvent will work | 94 | // when commenting the line below out the keyPressEvent will work |
93 | m_manager->handleWidget( this ); | 95 | m_manager->handleWidget( this ); |
94 | m_manager->load(); | 96 | m_manager->load(); |
95 | } | 97 | } |
96 | 98 | ||
97 | TestMainWindow::~TestMainWindow() { | 99 | TestMainWindow::~TestMainWindow() { |
98 | m_manager->save(); | 100 | m_manager->save(); |
101 | delete m_config; | ||
99 | } | 102 | } |
100 | 103 | ||
101 | Opie::Ui::OKeyConfigManager* TestMainWindow::manager() { | 104 | Opie::Ui::OKeyConfigManager* TestMainWindow::manager() { |
102 | return m_manager; | 105 | return m_manager; |
103 | } | 106 | } |
104 | 107 | ||
105 | /* | 108 | /* |
106 | * This only works if we do not handle the even with m_manager->handleWidget( this ) | 109 | * This only works if we do not handle the even with m_manager->handleWidget( this ) |
107 | * So this is only for demo purposes | 110 | * So this is only for demo purposes |
108 | */ | 111 | */ |
109 | void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { | 112 | void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { |
110 | qWarning( "String is "+ m_manager->handleKeyEvent( ev ).text() ); | 113 | qWarning( "String is "+ m_manager->handleKeyEvent( ev ).text() ); |
111 | qWarning( "Id was %d", m_manager->handleKeyEventId( ev ) ); | 114 | qWarning( "Id was %d %d %d %d", m_manager->handleKeyEventId( ev ),ev->key(),ev->state(), ev->ascii() ); |
115 | ev->ignore(); | ||
112 | } | 116 | } |
113 | 117 | ||
114 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { | 118 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { |
115 | qWarning( "Slot Delete %d %d %d", wid, ev->key(), ev->state() ); | 119 | qWarning( "Slot Delete %d %d %d", wid, ev->key(), ev->state() ); |
116 | } | 120 | } |
117 | 121 | ||