Results 1 to 7 of 7

Thread: mouseTracking in two widgets at the same time?

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question mouseTracking in two widgets at the same time?

    Hi, I want to know if it's possible to have two different widgets with mouseTracking enabled at the same time. I'm asking it because I have tried it and only with one widget mouseMoveEvent was executed everytime the mouse moves while in the other widget only if if i press a button and move the mouse the mouseMoveEvent is called. Anyone could explain me why? Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mouseTracking in two widgets at the same time?

    Did you call setMouseTracking(true) for both widgets?

  3. #3
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mouseTracking in two widgets at the same time?

    Yes, I call it in both I widgets

  4. #4
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mouseTracking in two widgets at the same time?

    Yes, I call it in both widgets: one widget is a widget itself and the other a main window...

  5. #5
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: mouseTracking in two widgets at the same time?

    it must work clearly!
    maiby some mistakes in code? show code fragments that release your mouse move events

  6. #6
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mouseTracking in two widgets at the same time?

    Quote Originally Posted by SkripT
    Yes, I call it in both widgets: one widget is a widget itself and the other a main window...
    Is there a widget inside that main window? You must set mouse tracking true for that, since if a widget contains another, it will not track mouse move events when the mouse cursor is within the contained widget.

  7. #7
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: mouseTracking in two widgets at the same time?

    I comment how I have the main window: as a central widget I have a scroll area, inside the scroll area I have the widget that has mouseTracking enabled. For the scroll area I don't need mouse tracking. In the three wigets (the main window, the scroll area and the widget itself) I reimplement the mouseMoveEvent. At the end of the mouseMoveEvent of the widget I call to event::ignore, so the event is propagated to it's parent, the scroll area. And the same for the scroll area, so the event is propagated to the main window (also runs if I don't put it). That's the situation. For the widget of the scroll area the mouseTracking works but for the main window only if I press a button of the mouse and I move it, the mouseMoveEvent is executed. Chicken Blood Machine dou you mind that I have to put the mouseTracking enabled also for the scroll area?
    Last edited by SkripT; 30th January 2006 at 17:38.

Similar Threads

  1. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  2. Replies: 2
    Last Post: 16th May 2008, 14:39
  3. Fast painting scrollable widget
    By bunjee in forum Qt Programming
    Replies: 20
    Last Post: 24th October 2007, 19:47
  4. When is the best time to delete a QCanvasItem
    By irudkin in forum Qt Programming
    Replies: 12
    Last Post: 8th March 2007, 21:28
  5. QDateTime GMT add sec. or - sec. from locale time....
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2007, 16:39

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.