Qt4 implementing move event for Main window dragging

  • Hi,

    I have a QWidget which is frameless and i want to create a move event for it to move the whole window just like it has a border,
    I've reimplemented moveEvent and mousePressEvent to realize the operation however it's not working as expected. the same application with border has another effect when i'm moving it, it's something like on this picture: http://i.stack.imgur.com/wl2Bq.png you can see the gray outline where it will be moved to.

    I'm doing it on python, how can i make application to use the normal move event?

    def mousePressEvent(self, QMouseEvent):
        self.offset = QMouseEvent.pos()
    def mouseMoveEvent(self, QMouseEvent):
        x_w = self.offset.x()
        y_w = self.offset.y()
        if y_w > 100 or x_w>self.width()-40: return
        self.move(x-x_w, y-y_w)

Log in to reply