Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How how to throw mouseMoveEvent from QGraphicsView to QGraphicsItem
Forum Updated to NodeBB v4.3 + New Features

How how to throw mouseMoveEvent from QGraphicsView to QGraphicsItem

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 290 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ValdermanV Offline
    ValdermanV Offline
    Valderman
    wrote on last edited by
    #1

    There is a class class QDMGraphicsView : public QGraphicsView
    It has:

    void QDMGraphicsView::mouseMoveEvent (QMouseEvent *event)
    {
        if (mode == MODE::DRAG_EDGE)
        {
            qDebug() << pos();
        }
        QGraphicsView::mouseMoveEvent(event);
    }
    

    And there is another class: class Node Edge : public QGraphicsPathItem
    And it has:

    void NodeEdge::mouseMoveEvent (QGraphicsSceneMouseEvent *event)
    {
        mousePosition = event->pos();
        qDebug() << "zzz" << mousePosition;
        QGraphicsItem::mouseMoveEvent(event);
    }
    

    Here I move the mouse over the scene, I have QDMGraphicsView::mouseMoveEvent processed. So I clicked somewhere and now I want to be processed NodeEdge::mouseMoveEvent
    How I could do that?

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #2

      Node Edge is stored inside QDMGraphicsView. Inside void QDMGraphicsView::mouseMoveEvent (QMouseEvent *event)
      call NodeEdge1 does this and NodeEdge2 does that when mouse event comes.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Did you set the QGraphicsItem::ItemIsMovable flag on your NodeEdge class ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        ValdermanV 1 Reply Last reply
        0
        • ValdermanV Offline
          ValdermanV Offline
          Valderman
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Did you set the QGraphicsItem::ItemIsMovable flag on your NodeEdge class ?

            ValdermanV Offline
            ValdermanV Offline
            Valderman
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved