Results 1 to 11 of 11

Thread: mouse tracking in QGraphicsItem

Hybrid View

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

    Default Re: mouse tracking in QGraphicsItem

    Could you prepare a minimal compilable example reproducing the problem?
    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. The following user says thank you to wysota for this useful post:

    christina123y (8th March 2009)

  3. #2
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 18 Times in 18 Posts

    Default Re: mouse tracking in QGraphicsItem

    Do you mean that absolutely nothing is output to the console or only no coordinates?
    Because there won't be any coordinates output as long as you don't ask for them.

    qDebug() << "mouse move " << endl;
    should be:
    qDebug() << "mouse move " << point.x() <<", "<<point.y()<<")"<<endl;

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

    christina123y (8th March 2009)

  5. #3
    Join Date
    Feb 2009
    Posts
    38
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    29

    Default Re: mouse tracking in QGraphicsItem

    Quote Originally Posted by boudie View Post
    Do you mean that absolutely nothing is output to the console or only no coordinates?
    Because there won't be any coordinates output as long as you don't ask for them.

    qDebug() << "mouse move " << endl;
    should be:
    qDebug() << "mouse move " << point.x() <<", "<<point.y()<<")"<<endl;
    Thank you for your reply. No,I mean I write some qdebug information in mousePressEvent function of Cordinate class. and I also write some qdebug information in mouseMoveEvent funciton of Cordinate class, and Cordinate class which has been called and inherit from QGraphicsItem ,and can draw coordinate system on QGraphicsView. and when i press mouse on the view, the Cordinate::mousePressEvent is called,so it can console the information which i had wrote.
    but the information i had wrote in the Cordinate::mouseMoveEvent function cann't be consoled. I think this function hasn't been called. What i want to is to track mouse move information,such as mouse position in the Cordinate. How can Cordinate::mouseMoveEvent can be called ? Because i think the mouse position information code must be written in this (Cordinate::mouseMoveEvent) function.

  6. #4
    Join Date
    Feb 2009
    Posts
    38
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    29

    Default Re: mouse tracking in QGraphicsItem

    Quote Originally Posted by wysota View Post
    Could you prepare a minimal compilable example reproducing the problem?
    Thank you for your answer,here is my simple test code .Just in the other computer,it's run correctly.But when copy it to my computer,I don't know why there didn't draw graph ,only draw cordinate.This mean that Cordinate class 's sub item didn't had been executed.Why?And the Cordinate class's mousePressEvent and mouseMoveEvent hasn't been done?
    Where, this code run in the other computer, it can print out mouse press info.but can't print out mouse move info.

    I want to track mouse move position.How can do this success? Wish anyone's help and appreciate very much!
    Attached Files Attached Files
    Last edited by christina123y; 8th March 2009 at 08:06.

Similar Threads

  1. mouse tracking on image
    By vermarajeev in forum Qt Programming
    Replies: 14
    Last Post: 12th May 2010, 14:06
  2. QGraphicsItem mouse events
    By zgulser in forum Qt Programming
    Replies: 13
    Last Post: 11th February 2009, 12:19
  3. Replies: 9
    Last Post: 22nd June 2008, 23:26
  4. Replies: 7
    Last Post: 8th September 2006, 17:19
  5. [QT3+XP] transparency and mouse tracking
    By incapacitant in forum Newbie
    Replies: 9
    Last Post: 17th February 2006, 19:49

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.