glyphCellView.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:defconQt 作者: trufont 项目源码 文件源码
def mousePressEvent(self, event):
        if event.button() in (Qt.LeftButton, Qt.RightButton):
            self._oldSelection = set(self._selection)
            index = self._findIndexForEvent(event)
            modifiers = event.modifiers()

            if index is None:
                if not (modifiers & Qt.ControlModifier or
                        modifiers & Qt.ShiftModifier):
                    # TODO: consider setSelection(None)
                    self.setSelection(set())
                return

            if modifiers & Qt.ControlModifier:
                if index in self._selection:
                    self._selection.remove(index)
                else:
                    self._selection.add(index)
            elif modifiers & Qt.ShiftModifier:
                self._selection = self._linearSelection(index)
            elif index not in self._selection:
                self._selection = {index}
            else:
                self._maybeDragPosition = event.localPos()
            self._lastSelectedCell = index
            self.selectionChanged.emit()
            self.update()
        else:
            super(GlyphCellWidget, self).mousePressEvent(event)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号