Qt override.

        This is needed to be able to intercept the Tab key press event.
425129
def event(self, event):
        
        if event.type() == QEvent.KeyPress:
            if (event.key() == Qt.Key_Tab or event.key() == Qt.Key_Space):
                text = self.text()
                cursor = self.cursorPosition()
                # fix to include in "undo/redo" history
                if cursor != 0 and text[cursor-1] == ' ':
                    text = text[:cursor-1] + ROW_SEPARATOR + ' ' +\
                        text[cursor:]
                else:
                    text = text[:cursor] + ' ' + text[cursor:]
                self.setCursorPosition(cursor)
                self.setText(text)
                self.setCursorPosition(cursor + 1)
                return False
        return QWidget.event(self, event)
169678
def keyPressEvent(self, keyEvent):
        
        undoObj = UndoSelfInsert(self, keyEvent.text())
        self.qteUndoStack.push(undoObj)
816836
def mouseDoubleClickEvent(self, event):
        
        item = self.itemAt(event.pos())
        column = self.columnAt(event.pos().x())
        
        mid_button = event.button() == QtCore.Qt.MidButton
        ctrl_click = event.button() == QtCore.Qt.LeftButton and \
                     event.modifiers() == QtCore.Qt.ControlModifier
        
        if mid_button or ctrl_click:
            self.itemMiddleDoubleClicked.emit(item, column)
        elif event.button() == QtCore.Qt.RightButton:
            self.itemRightDoubleClicked.emit(item, column)
        else:
            super(XTreeWidget, self).mouseDoubleClickEvent(event)
1281941
def keyPressEvent( self, event ):
        
        if ( self.scrollWidget().isHidden() ):
            if ( event.key() == Qt.Key_Escape ):
                self.cancelEdit()
                return
                
            elif ( event.key() in (Qt.Key_Return, Qt.Key_Enter) ):
                self.acceptEdit()
                return
            
        elif ( event.key() == Qt.Key_A and 
               event.modifiers() == Qt.ControlModifier ):
            self.startEdit()
        
        super(XNavigationEdit, self).keyPressEvent(event)
397863
def keyPressEvent(self, event):
        """"""
        if event == QKeySequence.Copy:
            self.copy()
        else:
            QTableView.keyPressEvent(self, event)
543632
def keyPressEvent(self, event):
        """"""
        if event.key() == Qt.Key_Down:
            self.select_row(1)
        elif event.key() == Qt.Key_Up:
            self.select_row(-1)
979922
def tab(self, n=1, interval=0, pre_dl=None, post_dl=None):
        
        self.delay(pre_dl)
        self.k.tap_key(self.k.tab_key, n, interval)
        self.delay(post_dl)
1117933
def key_press_event(self, event):
        
        input_buffer = self._get_input_buffer()
        ctrl = int(event.modifiers() & QtCore.Qt.ControlModifier) != 0
        shift = int(event.modifiers() & QtCore.Qt.ShiftModifier) != 0
        delete = event.key() in [QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Delete]
        ignore = False
        if delete and not input_buffer and not shift:
            return False
        if ctrl:
            if shift and event.key() == QtCore.Qt.Key_V:
                self.edit.insertPlainText(QtWidgets.qApp.clipboard().text())
                return False
            elif event.key() == QtCore.Qt.Key_L:
                self.edit.clear()
                if sys.platform == 'win32':
                    self.process.write(b'\r')
                self.process.write(b'\n')
                return False
        if (shift or ctrl) and event.key() == QtCore.Qt.Key_Backspace:
            if input_buffer.strip() != '':
                return True
            self._clear_user_buffer()
            return False
        if event.key() == QtCore.Qt.Key_Up:
            if self.is_code_completion_popup_visible():
                return True
            self._insert_command(self._history.scroll_up())
            return False
        if event.key() == QtCore.Qt.Key_Left:
            return bool(input_buffer)
        if event.key() == QtCore.Qt.Key_Down:
            if self.is_code_completion_popup_visible():
                return True
            self._insert_command(self._history.scroll_down())
            return False
        if event.key() == QtCore.Qt.Key_Home:
            tc = self.edit.textCursor()
            tc.movePosition(tc.StartOfBlock)
            tc.movePosition(tc.Right, tc.MoveAnchor, self.edit._formatter._prefix_len)
            self.edit.setTextCursor(tc)
            return False
        if event.key() == QtCore.Qt.Key_End:
            tc = self.edit.textCursor()
            tc.movePosition(tc.EndOfBlock)
            self.edit.setTextCursor(tc)
            self._cursor_pos = len(self._get_input_buffer())
            return False
        if event.key() in [QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter]:
            if self.is_code_completion_popup_visible():
                return True
            tc = self.edit.textCursor()
            tc.movePosition(tc.EndOfBlock)
            self.edit.setTextCursor(tc)
            # send the user input to the child process
            if self.edit.flg_use_pty or 'cmd.exe' in self.process.program():
                # remove user buffer from text edit, the content of the buffer will be
                # drawn as soon as we write it to the process stdin
                tc = self.edit.textCursor()
                for _ in input_buffer:
                    tc.deletePreviousChar()
                self.edit.setTextCursor(tc)
            self._history.add_command(input_buffer)
            if sys.platform == 'win32':
                input_buffer += "\r"
            input_buffer += "\n"
            self.process.write(input_buffer.encode())
            if self.edit.flg_use_pty or 'cmd.exe' in self.process.program():
                ignore = True
        return not ignore
159292
def mousePressEvent(self, event):
        """"""
        if event.button() == Qt.LeftButton:
            self.__drag_start_pos = QPoint(event.pos())
        QTabBar.mousePressEvent(self, event)
531650
def mousePressEvent(self, event):
        
        initial_state = event.isAccepted()
        event.ignore()
        self.mouse_pressed.emit(event)
        if event.button() == QtCore.Qt.LeftButton:
            cursor = self.cursorForPosition(event.pos())
            for sel in self.decorations:
                if sel.cursor.blockNumber() == cursor.blockNumber():
                    if sel.contains_cursor(cursor):
                        sel.signals.clicked.emit(sel)
        if not event.isAccepted():
            event.setAccepted(initial_state)
            super(CodeEdit, self).mousePressEvent(event)
898101
def event(self, event):
        
        if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
            self.sig_tab_pressed.emit(True)
            self.numpress += 1
            if self.numpress == 1:
                self.presstimer = QTimer.singleShot(400, self.handle_keypress)
            return True
        return QComboBox.event(self, event)
665424
def keyReleaseEvent(self, event):
        """"""
        if event.key() == Qt.Key_Alt:
            self._alt_key_is_down = False
            self.update()
1146704
function(e) {
      if (!this.dialog_.hasAttribute('tabindex')) {
        // Clicking on the backdrop should move the implicit cursor, even if dialog cannot be
        // focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this
        // would not be needed - clicks would move the implicit cursor there.
        var fake = document.createElement('div');
        this.dialog_.insertBefore(fake, this.dialog_.firstChild);
        fake.tabIndex = -1;
        fake.focus();
        this.dialog_.removeChild(fake);
      } else {
        this.dialog_.focus();
      }

      var redirectedEvent = document.createEvent('MouseEvents');
      redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,
          e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,
          e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
      this.dialog_.dispatchEvent(redirectedEvent);
      e.stopPropagation();
    }
603959
def keyPressEvent(self, event):
        
        if event.key() in (Qt.Key_Enter, Qt.Key_Return):
            self.queryEntered.emit(self.query())
        
        super(XOrbQuickFilterWidget, self).keyPressEvent(event)
566419
def _on_key_pressed(self, event):
        
        if not event.isAccepted():
            if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
                cursor = self.editor.textCursor()
                pre, post = self._get_indent(cursor)
                cursor.beginEditBlock()
                cursor.insertText("%s\n%s" % (pre, post))

                # eats possible whitespaces
                cursor.movePosition(cursor.WordRight, cursor.KeepAnchor)
                txt = cursor.selectedText()
                if txt.startswith(' '):
                    new_txt = txt.replace(" ", '')
                    if len(txt) > len(new_txt):
                        cursor.insertText(new_txt)
                cursor.endEditBlock()
                event.accept()
891277
def mousePressEvent(self, event):
        
        if event.button() == Qt.LeftButton:
            self._drag_origin = event.pos()
        widget = self.widget
        type(widget).mousePressEvent(widget, event)
85626
function tabBrowser_openTab(aEvent) {
    var event = aEvent || { };
    var type = (event.type == undefined) ? "menu" : event.type;

    // Disable tab closing animation for default behavior
    prefs.preferences.setPref(PREF_TABS_ANIMATE, false);

    // Add event listener to wait until the tab has been opened
    var self = { opened: false };
    function checkTabOpened() { self.opened = true; }
    this._controller.window.addEventListener("TabOpen", checkTabOpened, false);

    switch (type) {
      case "menu":
        var menuitem = new elementslib.Elem(this._controller.menus['file-menu'].menu_newNavigatorTab);
        this._controller.click(menuitem);
        break;
      case "shortcut":
        var cmdKey = utils.getEntity(this.getDtds(), "tabCmd.commandkey");
        this._controller.keypress(null, cmdKey, {accelKey: true});
        break;
      case "newTabButton":
        var newTabButton = this.getElement({type: "tabs_newTabButton"});
        this._controller.click(newTabButton);
        break;
      case "tabStrip":
        var tabStrip = this.getElement({type: "tabs_strip"});
        
        // RTL-locales need to be treated separately
        if (utils.getEntity(this.getDtds(), "locale.dir") == "rtl") {
          // XXX: Workaround until bug 537968 has been fixed
          this._controller.click(tabStrip, 100, 3);
          // Todo: Calculate the correct x position
          this._controller.doubleClick(tabStrip, 100, 3);
        } else {
          // XXX: Workaround until bug 537968 has been fixed
          this._controller.click(tabStrip, tabStrip.getNode().clientWidth - 100, 3);
          // Todo: Calculate the correct x position
          this._controller.doubleClick(tabStrip, tabStrip.getNode().clientWidth - 100, 3);
        }
        break;
      default:
        throw new Error(arguments.callee.name + ": Unknown event type - " + type);
    }

    try {
      this._controller.waitForEval("subject.tab.opened == true", TIMEOUT, 100,
                                   {tab: self});
    } finally {
      this._controller.window.removeEventListener("TabOpen", checkTabOpened, false);
      prefs.preferences.clearUserPref(PREF_TABS_ANIMATE);
    }
  }