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. Adding a QGraphicsView to a QGraphicsItem?
Forum Updated to NodeBB v4.3 + New Features

Adding a QGraphicsView to a QGraphicsItem?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.7k 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.
  • C Offline
    C Offline
    cfg83
    wrote on last edited by
    #1

    Hello -

    Is adding a QtGraphicsView object to a QGraphicsItem object difficult? I can't seem to Google an example.

    I ask because in QML (almost?) everything is a QGraphicsItem. We have legacy Qt code that uses a QGraphicsView to show a QGraphicsScene containing QGraphicsItems. Therefore I would like to add the QtGraphicsView to a pre-existing QML QGraphicsItem like "Rectangle" or "Item".

    Maybe the other solution is to expose a QGrpahicsView into QML using qmlRegisterType<>, but I can't seem to find a good example of that either.

    I know that the proper thing to do is port the QtGraphicsView functionality into a QML-only solution. My goal is that adding a QtGraphicsView object to a QGraphicsItem would be an interim step. I don't think there will be a major efficiency issue because the number of QGraphicItem objects should not exceed the very low tens. In addition, we are predicting situations where emergent requirements may require this solution.

    Thank You,

    cfg83

    1 Reply Last reply
    0
    • U Offline
      U Offline
      utcenter
      wrote on last edited by
      #2

      Why would you want to do that? I mean you can add items inside of other items and the view handles it as you would expect. Just like you can add a widget inside of a widget.

      Also in Qt5 QML is no longer using the QGV/I/S stack.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cfg83
        wrote on last edited by
        #3

        utcenter -

        [quote author="utcenter" date="1359568376"]Why would you want to do that? I mean you can add items inside of other items and the view handles it as you would expect. Just like you can add a widget inside of a widget.

        Also in Qt5 QML is no longer using the QGV/I/S stack.[/quote]

        As stated, it's only an interim step to demonstrate functionality on the way to full QML.

        Also, we are on Qt 4.8.x . For embedded development we are evaluating the Yocto project, which appears to support 4.8.1 and 4.8.3 as of December 7th, 2012. I just asked IRC:#yocto and the Qt version as of today is 4.8.4 .

        cfg83

        1 Reply Last reply
        0
        • U Offline
          U Offline
          utcenter
          wrote on last edited by
          #4

          Create a widget with a graphics view inside and wrap the widget in a QGraphicsProxyWidget.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tzander
            wrote on last edited by
            #5

            What about finding all the graphicsitems that are in your embedded view and adding those to your scene instead. Add a rectangle that clips to hold them all together...

            1 Reply Last reply
            0

            • Login

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