Override Qt method
168198
def paintEvent(self, event):
        """"""
        painter = QPainter(self)
        size = self.size()

        color = QColor(self.color)
        color.setAlphaF(.5)
        painter.setPen(color)

        for column in self.columns:
            x = self.editor.fontMetrics().width(column * '9')
            painter.drawLine(x, 0, x, size.height())
1083901
def mousePressEvent(self, event):
        """"""
        # Raise the main application window on click
        self.parent.raise_()
        self.raise_()

        if event.button() == Qt.RightButton:
            pass
191790
def reset_to_default(self):
        """"""
        reset = QMessageBox.warning(self, _("Shortcuts reset"),
                                    _("Do you want to reset "
                                      "to default values?"),
                                    QMessageBox.Yes | QMessageBox.No)
        if reset == QMessageBox.No:
            return
        reset_shortcuts()
        self.main.apply_shortcuts()
        self.table.load_shortcuts()
        self.load_from_conf()
        self.set_modified(False)
788570
def QTabCapsulate(self, name, widget_list, blocking = False):
        

        class QuickWindow(QtWidgets.QMainWindow):

            class Signals(QtCore.QObject):
                close = QtCore.Signal()
                show  = QtCore.Signal()

            def __init__(self, blocking = False, parent = None):
                super().__init__(parent)
                self.propagate = True # send signals or not
                self.setStyleSheet(style.main_gui)
                if (blocking):
                    self.setWindowModality(QtCore.Qt.ApplicationModal)
                self.signals = self.Signals()
                self.tab = QtWidgets.QTabWidget()
                self.setCentralWidget(self.tab)
                self.setLayout(QtWidgets.QHBoxLayout())

            def closeEvent(self, e):
                if (self.propagate):
                    self.signals.close.emit()
                e.accept()
                
            def showEvent(self, e):
                if (self.propagate):
                    self.signals.show.emit()
                e.accept()
                
            def setPropagate(self):
                self.propagate = True
                
            def unSetPropagate(self):
                self.propagate = False
                

        win = QuickWindow(blocking = blocking)
        win.setWindowTitle(name)
        for w in widget_list:
            win.tab.addTab(w[0], w[1])
        
        return win
969486
def keyPressEvent(self, event):
        """"""
        event, text, key, ctrl, shift = restore_keyevent(event)
        if key == Qt.Key_ParenLeft and not self.has_selected_text() \
          and self.help_enabled and not self.parent()._reading:
            self._key_paren_left(text)
        else:
            # Let the parent widget handle the key press event
            QTextEdit.keyPressEvent(self, event)
242864
def qteIsMiniApplet(self, obj):
        
        try:
            ret = obj._qteAdmin.isMiniApplet
        except AttributeError:
            ret = False

        return ret
1263691
def override(config, option, escape=false, &blk)
      # override if given on the command line
      if opt = input[option]
        opt = CFMicro.escape_path(opt) if escape
        config[option] = opt
      end
      config[option] = yield unless config[option]
    end
185194
def enable_busy_cursor(self):
        """"""
        QgsApplication.instance().setOverrideCursor(
            QtGui.QCursor(QtCore.Qt.WaitCursor)
        )
981320
def setData(self, index, value, role=Qt.EditRole):
        """"""
        if not index.isValid() or self.readonly:
            return False
        i = index.row()
        j = index.column()
        value = from_qvariant(value, str)
        dtype = self._data.dtype.name
        if dtype == "bool":
            try:
                val = bool(float(value))
            except ValueError:
                val = value.lower() == "true"
        elif dtype.startswith("string") or dtype.startswith("bytes"):
            val = to_binary_string(value, 'utf8')
        elif dtype.startswith("unicode") or dtype.startswith("str"):
            val = to_text_string(value)
        else:
            if value.lower().startswith('e') or value.lower().endswith('e'):
                return False
            try:
                val = complex(value)
                if not val.imag:
                    val = val.real
            except ValueError as e:
                QMessageBox.critical(self.dialog, "Error",
                                     "Value error: %s" % str(e))
                return False
        try:
            self.test_array[0] = val  # will raise an Exception eventually
        except OverflowError as e:
            print("OverflowError: " + str(e))  # spyder: test-skip
            QMessageBox.critical(self.dialog, "Error",
                                 "Overflow error: %s" % str(e))
            return False

        # Add change to self.changes
        self.changes[(i, j)] = val
        self.dataChanged.emit(index, index)
        if not is_string(val):
            if val > self.vmax:
                self.vmax = val
            if val < self.vmin:
                self.vmin = val
        return True
1157584
def get(key, default=-1):
        """"""
        if isinstance(key, int):
            return QS_Function(key)
        if key not in QS_Function._member_map_:
            extend_enum(QS_Function, key, default)
        return QS_Function[key]
777621
def keyPressEvent(self, event):
        """"""
        if event.key() in (Qt.Key_Enter, Qt.Key_Return):
            self.clicked()
        elif event.key() == Qt.Key_F2:
            self.rename()
        elif event.key() == Qt.Key_Delete:
            self.delete()
        elif event.key() == Qt.Key_Backspace:
            self.go_to_parent_directory()
        else:
            QTreeView.keyPressEvent(self, event)
375489
def leaveEvent(self, event):
        """"""
        if self.__cursor_changed:
            QApplication.restoreOverrideCursor()
            self.__cursor_changed = False
        self.QT_CLASS.leaveEvent(self, event)
904174
def _override_options(options, **overrides):
    """"""
    for opt, val in overrides.items():
        passed_value = getattr(options, opt, _Default())
        if opt in ('ignore', 'select') and passed_value:
            value = process_value(opt, passed_value.value)
            value += process_value(opt, val)
            setattr(options, opt, value)
        elif isinstance(passed_value, _Default):
            setattr(options, opt, process_value(opt, val))
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)
221206
def setData(self, index, value, role=QtCore.Qt.UserRole):
        """"""
        # item must already exist at provided index
        self._stim.overwriteComponent(value, index.row(), index.column())

        self.samplerateChanged.emit(self.samplerate())
1365456
def override_if_not_in_args(flag, argument, args):
  """"""
  if flag not in args:
    args.extend([flag, argument])
1083104
def openParametersDialog(params, title=None):
    '''
    
    '''
    QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor))
    dlg = ParametersDialog(params, title)
    dlg.exec_()
    QApplication.restoreOverrideCursor()
    return dlg.values