Results 1 to 4 of 4

Thread: Move the window

  1. #1
    Join Date
    May 2008
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4

    Default Move the window

    Hi,

    I removed the Caption bar..
    So now i want to know how to move the entire window when dragging the mouse..

    Thanks and regards,
    Santhosh

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Move the window

    Do it yourself !
    ie. reimplement the mousepress, mouse move and mouse release events.
    on mouse press you can hold a variable showing mousePressd= true. then in mouse move event, use QWidget::move

  3. #3
    Join Date
    May 2008
    Posts
    42
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4

    Default Re: Move the window

    Hi,

    I tried like that..
    I used a boolean m_MouseDown;

    This is the code i used in mouseMoveEvent()
    if(event->button() == Qt::LeftButton)
    {
    QPoint pt = event->pos();
    int x = pt.x();
    int y = pt.y();
    if(((x>0) && (x<25)) &&((y>0) && (y<25)))
    {
    move(x,y);
    }
    }

    is it correct or wrong?

    Thanks in advance..

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Move the window

    is it correct or wrong?
    You shud know it if u have run the program

    hint - on mousemove -
    move(globalPos - hotSpot) ... get the idea ??

Similar Threads

  1. Replies: 7
    Last Post: 17th July 2008, 21:47
  2. 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
  3. Fixing default Window position with move.
    By VireX in forum Qt Programming
    Replies: 4
    Last Post: 3rd April 2007, 21:13
  4. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  5. Move window in Clone Mode
    By ultrabrite in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2006, 18:22

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.