Results 1 to 5 of 5

Thread: Problem in MouseMove Event

  1. #1
    Join Date
    Jun 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem in MouseMove Event

    i want to Get the position( x,y) of the cursor moving on my custom QGraphicsView Control

    So, i made new class "MyQGraphicsView : QGraphicsView"

    then i defined and implemented "mouseMoveEvent"

    in MyQGraphicsView .h

    Qt Code:
    1. void mouseMoveEvent ( QMouseEvent * event);
    To copy to clipboard, switch view to plain text mode 

    in MyQGraphicsView.cpp

    Qt Code:
    1. void MyGraphicsViwer::mouseMoveEvent ( QMouseEvent * event )
    2. {
    3. MainForm->ui.Txt_xValue->setText((QString::number)(x()));
    4. }
    To copy to clipboard, switch view to plain text mode 

    the problem is in the first mouse move, the Txt_xValue displays value 100, then it doesn't change where ever the mouse moves.

    So ?

    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem in MouseMove Event

    Qt Code:
    1. viewport()->setMouseTracking(true);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Jun 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem in MouseMove Event

    Thanks for your reply, but .. it still not working.
    still displaying the same result "100"

  4. #4
    Join Date
    Jun 2008
    Location
    Saint-Petersburg
    Posts
    50
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem in MouseMove Event

    Qt Code:
    1. event -> x()
    To copy to clipboard, switch view to plain text mode 
    ? Do it works?

  5. #5
    Join Date
    Jun 2008
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem in MouseMove Event

    Thanks A lot jpn, Worked

Similar Threads

  1. mouseMove Event
    By fruzzo in forum Qt Programming
    Replies: 1
    Last Post: 3rd March 2008, 12:48
  2. Replies: 1
    Last Post: 16th October 2007, 23:41
  3. event problem
    By windkracht8 in forum Qt Programming
    Replies: 5
    Last Post: 17th August 2006, 12:52
  4. Replies: 2
    Last Post: 8th August 2006, 16:09
  5. Replies: 6
    Last Post: 3rd February 2006, 10:48

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.