Results 1 to 5 of 5

Thread: Dynamic creation of Scale object

  1. #1
    Join Date
    Jun 2006
    Posts
    43
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Dynamic creation of Scale object

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic creation of Scale object

    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,
    _

  3. #3
    Join Date
    Jun 2006
    Posts
    43
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic creation of Scale object

    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?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic creation of Scale object

    Instead of creating the Component from a file, you create it directly in code.

    Cheers,
    _

  5. #5
    Join Date
    Jun 2006
    Posts
    43
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic creation of Scale object

    And here was my complete lack of understanding.

    Qt Code:
    1. var scaleTransform = Scale
    2. scaleTransform.xScale = 2
    3. scaleTransform.yScale = 2
    To copy to clipboard, switch view to plain text mode 

    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?
    Last edited by Mookie; 28th March 2016 at 17:26.

Similar Threads

  1. Dynamic creation of list<transform>
    By Mookie in forum Qt Quick
    Replies: 1
    Last Post: 27th March 2016, 16:26
  2. Replies: 10
    Last Post: 1st August 2014, 07:50
  3. QMetaType dynamic object creation and initialization
    By d_stranz in forum Qt Programming
    Replies: 5
    Last Post: 24th July 2014, 11:12
  4. Dynamic creation of widget with N images
    By davethomaspilot in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2014, 13:45
  5. Dynamic widget creation from an XML-like file
    By ttvo in forum Qt Programming
    Replies: 2
    Last Post: 1st June 2009, 23:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.