Results 1 to 3 of 3

Thread: Grabbing mouse events from frame of top-level widget

  1. #1
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Grabbing mouse events from frame of top-level widget

    I want to control the positioning of my top-level widget on the desktop. I have not yet found a way to intercept the mouse events as I reposition the widget by dragging on the frame. I thought I might be able to use QFocusFrame to define a region larger than my widget to give me access to the mouse events, but so far I have been unsuccessful. I am able to get the behavior I want with a non top-level widget, but this requires that I implement all the window frame decorations (close, maximize, minimize, etc).

    Any suggestions or helpful links appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Grabbing mouse events from frame of top-level widget

    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.


  3. The following user says thank you to wysota for this useful post:

    mcb (21st June 2009)

  4. #3
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default

    The documentation for QMoveEvent reads:

    The QMoveEvent class contains event parameters for move events.

    Move events are sent to widgets that have been moved to a new position relative to their parent.

    The event handler QWidget::moveEvent() receives move events.

    My toy code suggests that a top-level widget never gets this event since there is no parent, and therefore, no relative position w.r.t. parent. Is this interpretation mistaken? Thanks.

    I revisited my code and found a simple error. I do in fact get the move events. Thanks.
    Last edited by wysota; 21st June 2009 at 10:01.

Similar Threads

  1. Changing mouse grabbing behavior?
    By FlyingSaucrDude in forum Qt Programming
    Replies: 0
    Last Post: 11th November 2008, 02:04
  2. Determining when mouse over widget without events
    By Kimmo in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2007, 11:48
  3. Handling Mouse Events of a parent widget
    By dvmorris in forum Qt Programming
    Replies: 2
    Last Post: 28th March 2007, 19:44
  4. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 20:25
  5. Forwarding mouse events to another widget.
    By yogeshm02 in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 14: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.