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
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView is embedded into the QGraphicsView,QGraphicsItem incomplete

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 1.1k 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.
  • W Offline
    W Offline
    wangcj
    wrote on 26 Oct 2018, 03:39 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 26 Oct 2018, 20:09 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
      • W Offline
        W Offline
        wangcj
        wrote on 27 Oct 2018, 06:41 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
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 27 Oct 2018, 07:04 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 :)

          W 1 Reply Last reply 27 Oct 2018, 08:02
          0
          • M mrjj
            27 Oct 2018, 07:04

            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 :)

            W Offline
            W Offline
            wangcj
            wrote on 27 Oct 2018, 08:02 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.

            M 1 Reply Last reply 27 Oct 2018, 09:04
            0
            • W wangcj
              27 Oct 2018, 08:02

              @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.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 27 Oct 2018, 09:04 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 ?

              W 1 Reply Last reply 29 Oct 2018, 01:32
              0
              • M mrjj
                27 Oct 2018, 09:04

                @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 ?

                W Offline
                W Offline
                wangcj
                wrote on 29 Oct 2018, 01:32 last edited by
                #7

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

                M 1 Reply Last reply 29 Oct 2018, 07:28
                0
                • W wangcj
                  29 Oct 2018, 01:32

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

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 29 Oct 2018, 07:28 last edited by
                  #8

                  @wangcj

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

                  W 1 Reply Last reply 30 Oct 2018, 12:35
                  0
                  • M mrjj
                    29 Oct 2018, 07:28

                    @wangcj

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

                    W Offline
                    W Offline
                    wangcj
                    wrote on 30 Oct 2018, 12:35 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

                    4/9

                    27 Oct 2018, 07:04

                    • Login

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