Hello,
I have a subclassed QDialog. Now I want to implement this "snap" or also called "dock" feature - when the user moves the window somewhere next to the screen edge, the window automatically snaps/docks to that edge. It's a pretty handy feature, I guess.
Well, my idea is to use moveEvent() and see if the right edge of the window is (say 5pixels) away from the edge - if so: this->move(edgeOfScreen). But I can't think of something how the "undock" feature should work? I mean if the user wants to move the window away from the edge again he probably won't be able to do it since it always will snap/dock back to the edge... ? Any ideas ?

One more thing: I have QDialog::moveEvent here like this:
Qt Code:
  1. void MyWindow::moveEvent(QMoveEvent *moveEvent)
  2. {
  3. moveEvent->ignore();
  4. }
To copy to clipboard, switch view to plain text mode 
Shouldn't Qt suppress the moving so the window can't be moved or do I misinterpret something here?