def focusInEvent(self, event): """ Work around a qt bug. See U{https://bugreports.qt-project.org/browse/QTBUG-32890}. This can be reproduced as follows: - ./kajongg.py --game=2/E2 --demo --ruleset=BMJA such that the human player is the first one to discard a tile. - wait until the main screen has been built - click with the mouse into the middle of that window - press left arrow key - this will violate the assertion in UITile.keyPressEvent. """ prev = self.focusItem() QGraphicsScene.focusInEvent(self, event) if prev and bool(prev.flags() & QGraphicsItem.ItemIsFocusable) and prev != self.focusItem(): self.setFocusItem(prev)
def focusInEvent(self, event): """ Work around a qt bug. See U{https://bugreports.qt-project.org/browse/QTBUG-32890}. This can be reproduced as follows: - ./kajongg.py --game=2/E2 --demo --ruleset=BMJA such that the human player is the first one to discard a tile. - wait until the main screen has been built - click with the mouse into the middle of that window - press left arrow key - this will violate the assertion in UITile.keyPressEvent. """ prev = self.focusItem() QGraphicsScene.focusInEvent(self, event) if prev and bool(prev.flags() & QGraphicsItem.ItemIsFocusable ) and prev != self.focusItem(): self.setFocusItem(prev)
def __init__(self): QGraphicsScene.__init__(self) self.focusRect = FocusRect() self.addItem(self.focusRect)