PDA

View Full Version : Dynamic creation of Scale object



Mookie
27th March 2016, 21:42
I am currently dynamically creating a Scale object with Qt.createQmlObject.

Is it possible to do with createObject?
If so, what URL would I give to get the component?

anda_skoa
28th March 2016, 00:25
Component.createObject() doesn't take an URL, did you mean Qt.createComponent()?
If so, the URL is the location of the QML file that defines the component.

Cheers,
_

Mookie
28th March 2016, 00:48
Yes, sorry, I meant Qt.createComponent.

The problem is that "Scale" is a built-in element. I don't see a QML file.
How does one dynamically instantiate a built-in element?

anda_skoa
28th March 2016, 10:22
Instead of creating the Component from a file, you create it directly in code.

Cheers,
_

Mookie
28th March 2016, 16:26
And here was my complete lack of understanding.



var scaleTransform = Scale
scaleTransform.xScale = 2
scaleTransform.yScale = 2


So much simpler than I thought. I'm getting this, slowly.
Thanks!

Added after 1 12 minutes:

So, that didn't work.

How does one create a native QML object (I don't have a QML file for it) dynamically without using createQmlObject?