Results 1 to 4 of 4

Thread: Construct dynamically a QML element

  1. #1
    Join Date
    Dec 2012
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Question Construct dynamically a QML element

    Hi everyone,

    I'm wondering how I can define a new QML element that need some "treatments" to be constructed.
    For example I want draw a compass, so it's not a basic Rectangle.. Obviously, I'm not going to define each line manually, I need kind of a loop which deals with an incremented angle value and so on...

    What would be the syntax ? Thank you for your help I just begin QML language so I have none experience...



    Bye

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Construct dynamically a QML element

    To be honest this kind of compass should be drawn in QtQuick using an image. I'm not saying you can't do that in pure QML but I think it's not worth the effort.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2012
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Construct dynamically a QML element

    Thank you for your answer

    After some search i've seen that it's indeed not appropriate in pure classic QML. But what about redefining a custom QQuickItem, i've seen that i can use pure OpenGL code in it. At the end I would obtain a QML component ready to use.
    Is that a good approach?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Construct dynamically a QML element

    Quote Originally Posted by keyga View Post
    After some search i've seen that it's indeed not appropriate in pure classic QML. But what about redefining a custom QQuickItem, i've seen that i can use pure OpenGL code in it. At the end I would obtain a QML component ready to use.
    Is that a good approach?
    As I said, it is not impossible to obtain but it is much more work than drawing such compass in a graphics editor and rendering it as an image.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 9
    Last Post: 23rd April 2012, 13:53
  2. How to construct a QTransform?
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2011, 15:20
  3. Must construct QApplication before QPaintDevice
    By sekatsim in forum Qt Programming
    Replies: 16
    Last Post: 8th June 2008, 00:00
  4. How to construct a ip contraler?
    By longtrue in forum Qt Programming
    Replies: 1
    Last Post: 7th March 2008, 06:48
  5. How to construct Image from Bytes
    By vishal.chauhan in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2007, 05:41

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.