0

There's a QQuickTransform C++ class which corresponds to the Transform QML class. Also the QML class Rotation derives from the Transform QML class. So it stands to reason that there should be a QQuickRotation C++ class as well, so I can perform type-safe operations on instances of QQuickTransform.

But I'm not finding such a class. Is it missing? Why?

Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
  • 1
    You have [`QSGTransformNode`](http://doc.qt.io/qt-5/qsgtransformnode.html) which has a [`matrix`](http://doc.qt.io/qt-5/qsgtransformnode.html#matrix) property. `QQuickTransform` isn't public though. I'm also not sure how it stands to reason that there should be a `QQuickRotation` when `Rotation` derives from `Transform`, which derives from `QQuickTransform`. Where would `QQuickRotation` fit into that hierarchy? – Mitch Sep 02 '16 at 18:13
  • @Mitch: 1. I don't want to use `QSGTransformNode`, since I don't know how to integrate that with QML elegantly. 2. There's a `` header that I have successfully included and used (called the setProperty method on it). If they didn't want it public, why did they let me include it? 3. `QQuickRotation` should derive from `QQuickTransform`, and Rotation should be just the QML "view" of QQuickRotation. – Stefan Monov Sep 02 '16 at 19:31
  • @Mitch: Re: QQuickTransform being nonpublic: Also, I've successfully called the `transform` method on a QQuickItem to get its transform stack (list of `QQuickTransform` objects), and used that to change a rotation angle. For some strange reason, though, it's undocumented, I'll give you that. :) – Stefan Monov Sep 02 '16 at 19:41
  • @Mitch: Ah, I had missed something in your comment. No, `Transform` doesn't derive from `QQuickTransform`, `Transform` is the QML class corresponding to the C++ class `QQuickTransform`. As the two classes live in 2 different languages, one cannot derive from the other. – Stefan Monov Sep 03 '16 at 16:06
  • Sorry; I said derives, but I meant instantiates. I don't know why it's exported publicly, but as long as it's not documented, it doesn't exist as a public API. That's how it's always been with Qt. Thinking about it more, you're probably right about the inheritance. Why do you need this in C++ though? I think you're better off learning about the scene graph; that's at least a public, documented API. [Here](http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/controls/material/qquickmaterialprogressstrip.cpp#n122)'s an example of using `QSGTransformNode`. – Mitch Sep 03 '16 at 17:01
  • You should ask about this on the mailing list, by the way. You would probably find out why it's publicly exposed by doing so, and you might also get some advice about the scene graph from its author. – Mitch Sep 03 '16 at 17:04

0 Answers0