Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9677

QDeclarativeProxyWidget

    XMLWordPrintable

Details

    Description

      It will probably not be a very original request and probably someone is working on something like this but there do not seem to be any similar open tasks in qt's bugtracker, so I allow myself to add this [probably not original at all] "suggestion" here:


      In the old ui I had a very complex custom widget. I used to use it also on QGraphicsView using QGraphicsProxyWidget. I would like to have this widget now also available as a qdeclarativeitem on a qdeclarativeview. I try to define a class in c++ and expose it to qml, and then create and manipulate object of this type from qml.

      I tried to use plain QGraphicsProxyWidget (after all qdeclarative view is a qgraphicsview ) : I works in a sense that I can create object of my class from qml and I can see it in my view (although in a very ugly/not-universal way: if I want to be able to add object from qml using block

      MyProxyWidget{
      }
      

      then I needed a bit of extra trickery to get to the scene to be able to call QGraphicsScene::addItem()). The problem is how to position/anchor/bind etc. it.

      • I cannot inherit additionally from QDeclarativeItem because QGraphicsObject would be inherited twice (once from QGraphicsProxyWidget and once QDeclarativeItem)
      • I tried to add to my class (inheriting QGraphicsProxyWidget) functionality added by QDeclarativeItem to QGraphicsObject (i.e. I started copying parts of code from qdeclarativeitem.cpp etc. to the files with my class); besides being hell of a chore, it failed on AnchorLines because QDeclarativeAnchorLine.item is of type "QDeclarativeItem *" so if I don't inherit from QDeclarativeItem I basically cannot use QDeclarativeAnchorLine...

      Feature request: make it easily possible to use old-fashioned widgets on qml-based view. Oh well, easier to say this than to implement I guess...

      Option 1:
      extract part of QDeclarativeItem which extends QGraphicsObject to a separate "base" class, so that then QDeclarativeItem would just inherit QGraphicsObject and QDeclarativeItemBase, but then it would also be possible for a user to create a class which inherits QGraphicsProxyWidget and QDeclarativeItemBase (then QDeclarativeAnchorLine.item: would be QDeclarativeItemBase* instead of QDeclarativeItem* etc.).

      Option 2:
      even simpler from our (developers') point of view: please introduce QDeclarativeProxyWidget class which would behave kind of like QGraphicsProxyWidget but would have qml anchors etc. (I.e. it would inherit QDeclarativeItem and add to it all functionality of QGraphicsProxyWidget).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            menard Alexis Menard (closed Nokia identity) (Inactive)
            wiecko Marek Wieckowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes