Method: Ruber::OpenFileInProjectDlg#eventFilter
- Defined in:
- lib/ruber/main_window/open_file_in_project_dlg.rb
#eventFilter(obj, e) ⇒ Object
Reimplements Qt::Object.eventFilter. It blocks the KeyPress
events for the
up and down keys (but only if there's no modifier) and redirects them to the
file list widget. All other events are allowed to pass. This allows to scroll
the list without taking the focus from the pattern widget.
=====Arguments
_obj_:: the object whose events should be filtered
_e_:: the event
160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/ruber/main_window/open_file_in_project_dlg.rb', line 160 def eventFilter obj, e if e.type != Qt::Event::KeyPress then return false else if (e.key == Qt::Key_Down || e.key == Qt::Key_Up) and e.modifiers == Qt::NoModifier # TODO: reintroduce the last parameter when it stops giving errors new_ev = Qt::KeyEvent.new e.type, e.key, e.modifiers, e.text, e.is_auto_repeat, e.count Ruber[:app].post_event @ui.file_list, new_ev true else false end end end |