Results 1 to 12 of 12

Thread: How to get mouse click events outside the Qt window?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to get mouse click events outside the Qt window?

    Make it fullscreen or the only application using the X server.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Sep 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get mouse click events outside the Qt window?

    try this.
    first actived current widget
    then
    overload the event function
    Qt Code:
    1. bool YourWidget::event ( QEvent * event )
    2. {
    3. if (event->type() == QEvent::ActivationChange)
    4. {
    5. if(QApplication::activeWindow() != this)
    6. {
    7. this->hide();
    8. }
    9. }
    10. return QWidget::event(event);
    11. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 18th September 2010 at 07:36.

  3. #3
    Join Date
    May 2013
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to get mouse click events outside the Qt window?

    maybe:

    void QWidget::leaveEvent(QEvent * event)
    {
    close();
    }

Similar Threads

  1. QGraphicsView Mouse Events
    By tomf in forum Qt Programming
    Replies: 5
    Last Post: 29th July 2008, 15:03
  2. Replies: 11
    Last Post: 15th July 2008, 13:11
  3. Replies: 1
    Last Post: 9th February 2007, 09:41
  4. Replies: 2
    Last Post: 24th July 2006, 18:36
  5. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 19:25

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.