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. Rectangle Item stops getting hover events
Forum Updated to NodeBB v4.3 + New Features

Rectangle Item stops getting hover events

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 356 Views
  • 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.
  • F Offline
    F Offline
    Forfunckle
    wrote on last edited by
    #1

    I am trying to create kind of a pixel art drawing program and I'm using QGraphicsView for the canvas. I have a rectangle item for every pixel (it's gonna be zoomed in). I have overrided the mouse hover event on the rectangle items but when I hold my left mouse button down, the rectangles stop getting mouse hover events. Does anyone have an idea why this could be happening?

    jsulmJ 1 Reply Last reply
    0
    • F Forfunckle

      Hi, I would like to have the ability to drag the mouse while keeping it pressed in order to draw on the canvas. How can I implement a mouse press - mouse move event system?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Forfunckle said in Rectangle Item stops getting hover events:

      How can I implement a mouse press - mouse move event system?

      Override https://doc.qt.io/qt-5/qwidget.html#mousePressEvent, https://doc.qt.io/qt-5/qwidget.html#mouseReleaseEvent and https://doc.qt.io/qt-5/qwidget.html#mouseMoveEvent
      Also set https://doc.qt.io/qt-5/qwidget.html#mouseTracking-prop
      Example: https://doc.qt.io/qt-5/qtwidgets-widgets-scribble-example.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • F Forfunckle

        I am trying to create kind of a pixel art drawing program and I'm using QGraphicsView for the canvas. I have a rectangle item for every pixel (it's gonna be zoomed in). I have overrided the mouse hover event on the rectangle items but when I hold my left mouse button down, the rectangles stop getting mouse hover events. Does anyone have an idea why this could be happening?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Forfunckle You get mouse hover event if you move the mouse cursor over the item. If you press and hold left mouse event you should get mouse press and mouse move events. Why do you need mouse hover event with pressed down left mouse button?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Forfunckle
          wrote on last edited by
          #3

          Hi, I would like to have the ability to drag the mouse while keeping it pressed in order to draw on the canvas. How can I implement a mouse press - mouse move event system?

          jsulmJ 1 Reply Last reply
          0
          • F Forfunckle

            Hi, I would like to have the ability to drag the mouse while keeping it pressed in order to draw on the canvas. How can I implement a mouse press - mouse move event system?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Forfunckle said in Rectangle Item stops getting hover events:

            How can I implement a mouse press - mouse move event system?

            Override https://doc.qt.io/qt-5/qwidget.html#mousePressEvent, https://doc.qt.io/qt-5/qwidget.html#mouseReleaseEvent and https://doc.qt.io/qt-5/qwidget.html#mouseMoveEvent
            Also set https://doc.qt.io/qt-5/qwidget.html#mouseTracking-prop
            Example: https://doc.qt.io/qt-5/qtwidgets-widgets-scribble-example.html

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1

            • Login

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