Results 1 to 3 of 3

Thread: Hide Dialog When Mouse Moves Outisde

  1. #1
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Hide Dialog When Mouse Moves Outisde

    I have a QDialog with setWindowFlags(Qt::Popup). I want to hide the QDialog as soon as the mouse moves outside the boundaries of the QDialog.

    I thought I might be able to use QWidget::focusOutEvent, but moving the mouse off the QDialog doesn't cause the QDialog to lose focus, so that doesn't work.

    I thought about tracking the mouse movement using QWidget::mouseMoveEvent, but this will only be called while the mouse is moving over the QDialog and not once it is moving outside the QDialog.

    Has anyone done this before or does anyone have any ideas?

  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: Hide Dialog When Mouse Moves Outisde

    May be you will need QWidget::grabMouse Do read the warnings that come in the doc.

  3. #3
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Hide Dialog When Mouse Moves Outisde

    I found void QWidget::leaveEvent ( QEvent * event ), which I can use to achieve exactly what I need.

Similar Threads

  1. Is it possible to hide mouse pointer??
    By webquinty in forum Newbie
    Replies: 5
    Last Post: 24th November 2009, 14:57
  2. How can I hide the mouse pointer?
    By dimaz in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2008, 19:08
  3. Reducing CPU load to min. when Mouse Moves
    By arunvv in forum Newbie
    Replies: 3
    Last Post: 19th February 2008, 17:34
  4. Reducing latency in mouse moves
    By PhilFM in forum Qt Programming
    Replies: 4
    Last Post: 6th September 2007, 09:38
  5. How to hide mouse cursor
    By kiransu123 in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2007, 17:52

Tags for this Thread

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.