Example #1
0
    def contextMenuEvent(self, event):
        menu = self.createStandardContextMenu()
        setStdEditMenuIcons(menu)

        if not self.isReadOnly():
            if self.textCursor().hasSelection():
                self._setFmtActs()
                self.fmtMenu.setEnabled(True)
            else:
                self.fmtMenu.setEnabled(False)
            before = menu.actions()[2]
            menu.insertSeparator(before)
            menu.insertMenu(before, self.fmtMenu)

        menu.exec_(event.globalPos())
        menu.deleteLater()
Example #2
0
 def contextMenuEvent(self, event):
     menu = self.createStandardContextMenu()
     setStdEditMenuIcons(menu)
     menu.exec_(event.globalPos())
     menu.deleteLater()