Results 1 to 3 of 3

Thread: Move Frames

  1. #1
    Join Date
    Sep 2009
    Posts
    64

    Default Move Frames

    I have an application with a settings frame with different toggle buttons and labels and such... I want the user to be able to click anywhere on the frame and be able to relocate the frames position within the application with a move of the mouse.

    I have looked into the mouseMoveEven but i am slightly confused, mostly because i am new to QT and semi-new to c++

    can anyone give me any tips? help is greatly appreciated.

    thanks

  2. #2
    Join Date
    Sep 2009
    Posts
    64

    Default Re: Move Frames

    let me show what i have and what happens, maybe someone can just give me a small tip as to how i can fix my code.

    Qt Code:
    1. void WeaponsInterface::mousePressEvent(QMouseEvent* event)
    2. {
    3. event->accept(); // do not propagate
    4. offset = event->pos();
    5. }
    6.  
    7. void WeaponsInterface::mouseMoveEvent(QMouseEvent* event)
    8. {
    9. event->accept(); // do not propagate
    10. move(mapToParent(event->pos() - offset));
    11. }
    12.  
    13. void WeaponsInterface::mouseReleaseEvent(QMouseEvent* event)
    14. {
    15. event->accept(); // do not propagate
    16. offset = QPoint();
    17. }
    To copy to clipboard, switch view to plain text mode 

    so, this code does succeed in moving a frame in my application, the only problem is that it moves the parent frame, of all my components in my application. How can i specify it to only move the frame i am selecting, and not move the frame i am selecting's parent?

  3. #3
    Join Date
    Sep 2009
    Posts
    64

    Default Re: Move Frames

    still having same problems... i figured taking out the "moveToParent()" would possibly make it only move the frame i wanted, but when i remove the moveToParent() it does the same this except when the whole parent frame moves it is very shaky and not a smooth move...

    anyone have any suggestions?

Similar Threads

  1. How to move child widget with parent widget?
    By anupamgee in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 15:23
  2. Replies: 1
    Last Post: 22nd November 2008, 06:32
  3. Move and resize with layout
    By waediowa in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2008, 08:16
  4. How do I natively move a QWidget top-level window?
    By codeslicer in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2008, 21:08
  5. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.