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. QGraphicsView is embedded into the QGraphicsView,QGraphicsItem incomplete
QtWS25 Last Chance

QGraphicsView is embedded into the QGraphicsView,QGraphicsItem incomplete

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 1.1k 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.
  • wangcjW Offline
    wangcjW Offline
    wangcj
    wrote on last edited by
    #1

    I have a QGraphicsView embedded into the QGraphicsView view via the QGraphicsProxyWidget, and the QGraphicsItem displayed on the embedded QGraphicsView is incomplete. Is there any way to display the scene content of embedded QGraphicsView properly?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      By incomplete - you mean not all of the inner QGraphicsView is visible ?
      Or that the QGraphicsView is smaller than it should be ?
      Im wondering if you need to use
      http://doc.qt.io/qt-5/qgraphicsview.html#fitInView

      1 Reply Last reply
      0
      • wangcjW Offline
        wangcjW Offline
        wangcj
        wrote on last edited by
        #3

        @mrjj
        Thank you .
        I don't think I have expressed it clearly. Still come to a picture to explain.0_1540621729179_Image 4.png
        What caused this? Is it related to the transform of QGraphicsProxyWidget?

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

          Hi
          Super with pictures.
          So its not drawn at all it seems.
          and you are sure its located as shown on second image ?
          I mean, it has that size etc?

          the purple rect is a normal QGraphicsRectItem ?

          Im not 100% sure that QGraphicsProxyWidget can handle a QGraphicsView due the event
          and coordinates propagation/handling.
          On the other hand, it is a Widget so no apparent reason why not.

          ps. btw, welcome to the forums :)

          wangcjW 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Super with pictures.
            So its not drawn at all it seems.
            and you are sure its located as shown on second image ?
            I mean, it has that size etc?

            the purple rect is a normal QGraphicsRectItem ?

            Im not 100% sure that QGraphicsProxyWidget can handle a QGraphicsView due the event
            and coordinates propagation/handling.
            On the other hand, it is a Widget so no apparent reason why not.

            ps. btw, welcome to the forums :)

            wangcjW Offline
            wangcjW Offline
            wangcj
            wrote on last edited by
            #5

            @mrjj
            Hi
            Thanks for your help

            I am sure its were created and size are correct.
            yes, the purple rect is a normal QGraphicsRectItem.

            I find QGraphicsProxyWidget pos is (0,0) ,
            All item and widget under QGraphicsView can be displayed.
            But I still don't know why.
            maybe the transform of QGraphicsProxyWidget causes the render area of the item to be incorrect.

            ps. I am very happy to join the forums.

            mrjjM 1 Reply Last reply
            0
            • wangcjW wangcj

              @mrjj
              Hi
              Thanks for your help

              I am sure its were created and size are correct.
              yes, the purple rect is a normal QGraphicsRectItem.

              I find QGraphicsProxyWidget pos is (0,0) ,
              All item and widget under QGraphicsView can be displayed.
              But I still don't know why.
              maybe the transform of QGraphicsProxyWidget causes the render area of the item to be incorrect.

              ps. I am very happy to join the forums.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @wangcj
              I also suspect the coordinates mapping might be incorrect for the nested QGraphicsView .
              In theory it should work but seems not from your actual code.
              The docs
              http://doc.qt.io/qt-5/graphicsview.html
              says
              " You can even embed a new QGraphicsView into your scene to provide complex nested scenes."

              so it sounds like it should work. :)

              What Qt version are you using ?

              wangcjW 1 Reply Last reply
              0
              • mrjjM mrjj

                @wangcj
                I also suspect the coordinates mapping might be incorrect for the nested QGraphicsView .
                In theory it should work but seems not from your actual code.
                The docs
                http://doc.qt.io/qt-5/graphicsview.html
                says
                " You can even embed a new QGraphicsView into your scene to provide complex nested scenes."

                so it sounds like it should work. :)

                What Qt version are you using ?

                wangcjW Offline
                wangcjW Offline
                wangcj
                wrote on last edited by
                #7

                @mrjj
                The Qt version I use is Qt5.6.1.

                mrjjM 1 Reply Last reply
                0
                • wangcjW wangcj

                  @mrjj
                  The Qt version I use is Qt5.6.1.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @wangcj

                  Would it be possible to test if it works in Qt5.11?
                  else i think you found a bug.

                  wangcjW 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @wangcj

                    Would it be possible to test if it works in Qt5.11?
                    else i think you found a bug.

                    wangcjW Offline
                    wangcjW Offline
                    wangcj
                    wrote on last edited by
                    #9

                    @mrjj
                    You are right,It works normally in Qt5.11.
                    thank you very much for your help. :)

                    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