示例#1
0
    def wheelEvent(self, event):
        num_degrees = event.angleDelta() / 8
        num_steps = int(num_degrees.manhattanLength() / 15)

        for _ in range(num_steps):
            if num_degrees.x() > 0 or num_degrees.y() > 0:
                self.comp.zoom_in(Point.from_qt(event.pos()))
            else:
                self.comp.zoom_out(Point.from_qt(event.pos()))
示例#2
0
    def mouseMoveEvent(self, event):
        workspace = self.comp.get_workspace()
        ev = InputEvent.from_qt(event)
        workspace.mouse_move(ev)
        self.repaint()

        pos = self.comp.screen2world(Point.from_qt(event.pos()))
        self.sig_mouse_move(pos)
示例#3
0
    def mouseMoveEvent(self, event):
        self.mouse_pos = Point.from_qt(event.pos())

        cell_w = self.width() / self.get_columns()
        x = int(event.x() // cell_w)
        y = int(event.y() // self.cell_height)

        self.mouse_over_tile = y * self.get_columns() + x

        if self.mouse_over_tile < 0 or self.mouse_over_tile >= len(self.brushes):
            self.mouse_over_tile = -1

        if self.mouse_over_tile > -1:
            self.setToolTip(self.brushes[self.mouse_over_tile].get_data())

        self.repaint()
 def mouseMoveEvent(self, event):
     pos = self.get_mouse_tile_pos(Point.from_qt(event.pos()))
     self.current_pos = pos
     self.mouse_over_tile = pos.y * self.columns + pos.x
     self.repaint()
示例#5
0
 def dropEvent(self, event):
     data = event.mimeData().data("application/x-supertux-badguy")
     pos = self.comp.screen2world(Point.from_qt(event.pos()))
     self.sig_drop(data, pos)