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. MVC pattern with QGraphicsItem
Qt 6.11 is out! See what's new in the release blog

MVC pattern with QGraphicsItem

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 945 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.
  • D Offline
    D Offline
    Desfell
    wrote on last edited by
    #1

    Hi, I have made a simple MVC with a box that contains text. I have controller, which handles all the requests from outside, the model which stores the data and view which represents the cube itself on QGraphicsScene. My question is how to register a double-click, or mouse release on the view, when it cannot send signals, nor can include the controller, because of circular include?

    1 Reply Last reply
    0
    • D Desfell

      @SGaist I would like to do that, but QGraphicsItem cannot emit signals :{

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #6

      @Desfell said in MVC pattern with QGraphicsItem:

      QGraphicsItem cannot emit signals :{

      No but QGraphicsObject Class adds just that if it's what you are missing.

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

        Hi and welcome to devnet,

        Why do you have circular dependencies ?

        What type of item are you using ?

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

        D 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Why do you have circular dependencies ?

          What type of item are you using ?

          D Offline
          D Offline
          Desfell
          wrote on last edited by
          #3

          @SGaist No circular dependencies just yet - that was just a horrible idea I had and thankfully did not implement :D So far there is a QGraphicsItem that is the view, with another class, of QWidget, which is supposed to be the controller. I am just curious how to detect on the controller, that the view was double-clicked for example.

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

            Emit a signal from the view that you will connect on the controller.

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

            D 1 Reply Last reply
            0
            • SGaistS SGaist

              Emit a signal from the view that you will connect on the controller.

              D Offline
              D Offline
              Desfell
              wrote on last edited by
              #5

              @SGaist I would like to do that, but QGraphicsItem cannot emit signals :{

              JonBJ 1 Reply Last reply
              0
              • D Desfell

                @SGaist I would like to do that, but QGraphicsItem cannot emit signals :{

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #6

                @Desfell said in MVC pattern with QGraphicsItem:

                QGraphicsItem cannot emit signals :{

                No but QGraphicsObject Class adds just that if it's what you are missing.

                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