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 to detecting moveEvent in child widget?
Forum Update on Monday, May 27th 2025

How to detecting moveEvent in child widget?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.4k 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.
  • L Offline
    L Offline
    lygstate
    wrote on 10 Feb 2014, 14:35 last edited by
    #1

    I want to detecting the moveEvent when the Root QWidget is moving.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 10 Feb 2014, 17:16 last edited by
      #2

      When parent is moved, you would like to receive this event in child object ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • O Offline
        O Offline
        otttx33
        wrote on 10 Feb 2014, 17:21 last edited by
        #3

        i think you must overload the void mouseMoveEvent() inside you QWidget
        with something like this
        @
        protected:
        YourWidget::mouseMoveEvent(QGraphicsSceneMouseEvent *event);@

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lygstate
          wrote on 11 Feb 2014, 02:51 last edited by
          #4

          This answer can partially solve the problem, but only handle the move that triggered by the mouse, because we can also use keyboard to move a QWidget, I want it's child widget also respond to it's movement, how to do that?

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lygstate
            wrote on 15 Feb 2014, 02:12 last edited by
            #5

            We can use the following event forward to do that, but there is a problem, the MainWidget should be the Root widget, and sometimes, the childWidget my be dynamic.
            So how I do that to add this functional in cihldWidget's constructor or some other place?
            @
            void MainWidget::moveEvent(QMoveEvent *e)
            {
            QWidget::moveEvent(e);
            QApplication::sendEvent(ui->childWidget, e);
            }
            @

            1 Reply Last reply
            1

            1/5

            10 Feb 2014, 14:35

            • Login

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