Results 1 to 2 of 2

Thread: QMouseEvent->pos() gives different results for Qt-4.7.4 and Qt-5.11

  1. #1
    Join Date
    Apr 2016
    Posts
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QMouseEvent->pos() gives different results for Qt-4.7.4 and Qt-5.11

    The attached code works fine on Centos 5 with Qt-4.7.4 and qwt-6.1.2. However, when I run on Centos 7 with Qt-5.11 and qwt-6.1.3, I get much different results. The std::cout where I print the x and y values of p_mouse_event->pos() look reasonable on Centos 5, but I get 0 for both x and y on Centos 7.
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2016
    Posts
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QMouseEvent->pos() gives different results for Qt-4.7.4 and Qt-5.11

    I was able to fix this by changing the cast on line 56. Instead of casting to a QMouseEvent, I cast it to a QContextMenuEvent.

    WRONG: const QMouseEvent *p_mouse_event = static_cast<QMouseEvent *>(p_event);
    RIGHT: const QContextMenuEvent *p_mouse_event = static_cast<QContextMenuEvent *>(p_event);

Similar Threads

  1. mouseReleaseEvent(QMouseEvent *)
    By migel in forum Newbie
    Replies: 0
    Last Post: 28th October 2011, 12:05
  2. QMouseevent
    By jerkymotion in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2011, 08:58
  3. QMouseEvent
    By Fallen_ in forum Qt Programming
    Replies: 1
    Last Post: 22nd September 2010, 06:17
  4. QMouseEvent
    By shenakan in forum Newbie
    Replies: 1
    Last Post: 20th August 2009, 15:53
  5. help needed in QMouseEvent
    By aj2903 in forum Qt Programming
    Replies: 21
    Last Post: 14th February 2009, 12:15

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.