Results 1 to 18 of 18

Thread: Move mouse over object

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Move mouse over object

    Quote Originally Posted by ToddAtWSU View Post
    My problem is when I move over the top QGLWidget it seems like it is asking for the scale factors from the bottom QGLWidget and not the top QGLWidget. But once I click on the top QGLWidget, then everything works how I expect it to.
    Do event->x() and event->y() return the same values for the top widget in both cases or maybe sometimes you get the mouse position relative to that bottom QGLWidget?

  2. #2
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Move mouse over object

    Quote Originally Posted by jacek View Post
    Do event->x() and event->y() return the same values for the top widget in both cases or maybe sometimes you get the mouse position relative to that bottom QGLWidget?
    Yes they return the same value. event->y( ) returns values between 0-185 and event->x( ) returns 79-955. Both before and after I click on the top QGLWidget.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Move mouse over object

    Quote Originally Posted by ToddAtWSU View Post
    Yes they return the same value. event->y( ) returns values between 0-185 and event->x( ) returns 79-955. Both before and after I click on the top QGLWidget.
    This means that other variables in that conversion formula must have wrong values. How and when do you set them?

  4. The following user says thank you to jacek for this useful post:

    ToddAtWSU (3rd October 2007)

  5. #4
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Smile Re: Move mouse over object

    Quote Originally Posted by jacek View Post
    This means that other variables in that conversion formula must have wrong values. How and when do you set them?
    I set them upon creation of the QGLWidget. I have some other functions that get called by the constructor and create the data set that goes and calculates my mins, maxs, widths, and heights for all my different objects. But it looks like I might not be storing my mins and maxs like I thought I was...so I will look more deeply into this and let you know if this is what it is. Thanks a whole lot!!!

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Move mouse over object

    Quote Originally Posted by ToddAtWSU View Post
    I set them upon creation of the QGLWidget.
    Remember that widget size isn't correct until the widget is shown for the first time.

  7. #6
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Move mouse over object

    The widget size wasn't causing my problem. I was forgetting to initialize my mYMin value after I added data. The data itself knew what the min was, but since I use it so frequently I had a variable in my other class to hold it, and I forgot to update it. But now that I initialized it, it works fine! Thanks for your help and I guess I should debug more first before blaming Qt!

Similar Threads

  1. Replies: 2
    Last Post: 4th August 2007, 04:31
  2. Tool Tip on mouse move in QTreeWidget?
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 27th June 2007, 08:42
  3. Mouse Move Event
    By merry in forum Newbie
    Replies: 5
    Last Post: 3rd June 2007, 06:26
  4. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34
  5. how to display full tree item name on mouse move ?
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 15th November 2006, 08:41

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
  •  
Qt is a trademark of The Qt Company.