Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt4 implementing move event for Main window dragging
Qt 6.11 is out! See what's new in the release blog

Qt4 implementing move event for Main window dragging

Scheduled Pinned Locked Moved General and Desktop
pythonqwidget
1 Posts 1 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Streakflash
    wrote on last edited by
    #1

    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
        x=QMouseEvent.globalX()
        y=QMouseEvent.globalY()
        self.move(x-x_w, y-y_w)
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved