Results 1 to 1 of 1

Thread: mouseMoveEvent in QGraphicsView/QGraphicsScene triggers only on a part of the view

  1. #1
    Join Date
    Oct 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mouseMoveEvent in QGraphicsView/QGraphicsScene triggers only on a part of the vie

    I am really frustrated with this.

    I implemented a QGraphicsScene/QGraphicsView with no items at this time.
    I use mouse* events to pan/zoom the view in QGraphicsView, and I want to use mouse* events in QGraphicsScene to add objects and manipulate them in the future.
    I use drawBackground for a grid in the view and drawForeground for a tiny tooltip-like window that moves along with the mouse cursor in the view.
    setMouseTracking on the viewport() is true.

    All work fine as I thought, except mouseMoveEvents are triggered only on the upper 3/4 of the view. The estimation of 3/4 is approximate.
    The circled red area is where the mouseMoveEvent is triggered all the time. The little red dots show some points where the mouseMoveEvent is triggered from time to time.

    Any first ideas before posting any code?

    test1.jpg


    Added after 1 58 minutes:


    Found the problem, although I don't know why it happens.

    I was creating my main gui with the following:
    Qt Code:
    1. m_view= new saView(0);
    2. m_textOut= new QLabel();
    3. m_textOut2=new QLabel();
    4. QGridLayout *layout = new QGridLayout;
    5. layout->addWidget(m_view,0,0,-1,-1);
    6. layout->addWidget(m_textOut,1,0);
    7. layout->addWidget(m_textOut2,1,1);
    8. setLayout(layout);
    To copy to clipboard, switch view to plain text mode 
    removing the two "-1" as layout->addWidget(m_view,0,0); and the problem disappeared!
    I can understand why it is related, because I checked the viewport() values of m_view and it seemed right.
    Last edited by hayzel; 3rd July 2014 at 10:24.

Similar Threads

  1. Replies: 2
    Last Post: 10th February 2014, 06:39
  2. Replies: 2
    Last Post: 14th January 2011, 09:55
  3. Replies: 5
    Last Post: 31st December 2010, 12:49
  4. mouseMoveEvent problem in QGraphicsView/QGraphicsScene
    By Lendrick in forum Qt Programming
    Replies: 3
    Last Post: 23rd September 2010, 06:26
  5. QGraphicsScene::mouseMoveEvent Question
    By harakiri in forum Qt Programming
    Replies: 3
    Last Post: 3rd March 2008, 15:54

Tags for this Thread

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.