Class: Ruber::Workspace::StackedWidget
- Inherits:
-
Qt::StackedWidget
- Object
- Qt::StackedWidget
- Ruber::Workspace::StackedWidget
- Defined in:
- lib/ruber/main_window/workspace.rb
Overview
Class used by ToolManager to display the currently selected widget. It’s a Qt::WidgetStack which handles the keyPressEvent when the key is either Esc or Shift+Esc. In the former case, the tool widget is hidden; in the latter the focus is given back to the editor.
===TODO See whether this can somehow managed using shortcutsInstance Method Summary (collapse)
-
- (Object) keyPressEvent(e)
protected
Handles the key press event.
Methods inherited from Qt::StackedWidget
Instance Method Details
- (Object) keyPressEvent(e) (protected)
Handles the key press event. First, it calls the method of the parent class, then if the event hasn’t been accepted, activates the editor if the key was Shift + Esc or hides the current tool (thus activating the editor) if the key was Esc with no modifiers. =Arguments e:: the event (Qt::KeyEvent)
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/ruber/main_window/workspace.rb', line 78 def keyPressEvent e super e return if e.accepted? if e.key == Qt::Key_Q and e.modifiers == Qt::ShiftModifier.to_i Ruber[:main_window].activate_editor elsif e.key == Qt::Key_Q and e.modifiers == Qt::NoModifier.to_i Ruber[:main_window]. else e.ignore end end |