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. modeless QDialog passes mouse click event to its parent
Forum Updated to NodeBB v4.3 + New Features

modeless QDialog passes mouse click event to its parent

Scheduled Pinned Locked Moved Unsolved General and Desktop
opencvqwidgetqdialogmouse event
5 Posts 3 Posters 1.7k Views 2 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.
  • S Offline
    S Offline
    shawnL
    wrote on last edited by
    #1

    some brief example lines of code would be helpful. This is my first project with Qt + OpenCV, I barely know programming model concepts of Qt and the terminology to do a good google

    I have some QWidget as a main window, when its button clicked, the pop-up window shown up with an image (similar to cv::imshow). I am thinking this can be done by a modeless QDialog containing a QLabel to show the image (elsewhere has shown how to convert cv::Mat to Qt-compatible)? I expect QDialog also has mouse event

    How to pass the mouse event (clicked position) to the parent QWidget? since main processing flow is in this widget to update the processed image and shown again in the QDialog

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

      Hi and welcome to devnet,

      What exactly would you like to pass back to the main window from that dialog ?

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

      S 1 Reply Last reply
      1
      • S shawnL

        some brief example lines of code would be helpful. This is my first project with Qt + OpenCV, I barely know programming model concepts of Qt and the terminology to do a good google

        I have some QWidget as a main window, when its button clicked, the pop-up window shown up with an image (similar to cv::imshow). I am thinking this can be done by a modeless QDialog containing a QLabel to show the image (elsewhere has shown how to convert cv::Mat to Qt-compatible)? I expect QDialog also has mouse event

        How to pass the mouse event (clicked position) to the parent QWidget? since main processing flow is in this widget to update the processed image and shown again in the QDialog

        CP71C Offline
        CP71C Offline
        CP71
        wrote on last edited by
        #3

        @shawnL
        Hi,
        I think these posts can help you:

        https://doc.qt.io/qt-5/qobject.html#installEventFilter

        http://programmingexamples.wikidot.com/qt-events

        1 Reply Last reply
        1
        • SGaistS SGaist

          Hi and welcome to devnet,

          What exactly would you like to pass back to the main window from that dialog ?

          S Offline
          S Offline
          shawnL
          wrote on last edited by
          #4

          @SGaist it 's the mouse event (clicked position)

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

            Then add a signal to your dialog that you will emit when needed from your mouse move event.

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

            1 Reply Last reply
            2

            • Login

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