Results 1 to 11 of 11

Thread: QDeclarativeView question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: QDeclarativeView question

    Quote Originally Posted by cmessineo View Post
    I thought there would be a mechanism for me to hook into when something like this happened:

    Timer {
    interval: 10000
    running: true
    onTriggered: if(root.someItem) { root.someItem.destroy(); root.someItem = null }
    }
    There are too many situations like that that can cause you trouble. You will not patch and stitch each and every one.

    Or even if a QML Item was created through javascript. Some signal that an object was created or destroyed.
    You can do that using QGraphcisItem API but that will be hell slow since you'd be monitoring every item in the scene. I assure you this is a wrong way to approach your problem. The proper way is to expose some API to QML scripts and ask authors of the scritps to use that API.

    E.g. something along the lines of:

    javascript Code:
    1. Item {
    2. id: myObject
    3. ChangeListener {
    4. name: "myObject"
    5. properties: [ "width", "height", "x", "y" ] // listen to changes on these properties
    6. onChanged: myObject[propName] = value // propName and value are parameters of onChanged signal
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

    or even:
    javascript Code:
    1. Item {
    2. id: myObject
    3. objectName: "myObject"
    4. ChangeListener {
    5. target: myObject
    6. properties: [ "width", "height", "x", "y" ]
    7. // updating the property is done in C++
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 2nd July 2015 at 07:18.
    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. How to unload a QDeclarativeView object
    By nestuser in forum Newbie
    Replies: 0
    Last Post: 17th August 2012, 06:45
  2. How QDeclarativeView destruction
    By xman_ss in forum Qt Programming
    Replies: 3
    Last Post: 27th April 2012, 07:55
  3. Drag into a QDeclarativeView
    By frankiefrank in forum Qt Quick
    Replies: 1
    Last Post: 3rd October 2011, 12:12
  4. Resize QDeclarativeView
    By Globulus in forum Qt Programming
    Replies: 3
    Last Post: 29th August 2011, 17:31
  5. Using QDeclarativeView::Show()
    By proj_symbian in forum Qt Quick
    Replies: 17
    Last Post: 30th May 2011, 19:26

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.