Results 1 to 1 of 1

Thread: QML Property Binding update does not propagate

  1. #1
    Join Date
    Jul 2012
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QML Property Binding update does not propagate

    Hi,

    I have a QML property size, which I am trying to use to change many of my attributes to half size when I reach a split screen state. However, when I update the size property in this state, the reduction in size does not propogate to things such as font size which depend upon it.
    Qt Code:
    1. Item{
    2. id:navTab
    3. property bool split: data.splitScreen
    4. property double size: 1
    5. Rectangle {
    6. width: 100*navTab.size
    7. height: 100*navTab.size
    8. color: "black"
    9. border.color: "lawngreen"
    10. border.width: 5*navTab.size
    11. Text{
    12. anchors.centerIn: parent
    13. text: "Info"
    14. font.pointSize: 18*navTab.size
    15. color: "white"
    16. }
    17. radius: 10*navTab.size
    18. }
    19. states: [
    20. State{
    21. name: "split"; when: split
    22. PropertyChanges {
    23. target: navTab
    24. size: 1/2
    25. }
    26. }
    27. ]
    28. }
    To copy to clipboard, switch view to plain text mode 

    What am I missing about bindings here, which will allow me to do this?

    I have also tried simplifying this and using a fontsize property, but even this alone does not propagate when updated.
    Qt Code:
    1. Text {
    2. text: "HEADING"
    3. font.pointSize: navTab.fontsize
    4. color: "white"
    5. }
    6. State{
    7. name: "split"; when: carData.splitScreen
    8. PropertyChanges {
    9. target: navTab
    10. fontsize: 9
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 

    Also, trying to create a dependency on a function doesn't seem to work either
    Qt Code:
    1. function getFontSize(){
    2. return navTab.fontsize;
    3. }
    4. Text{
    5. text: "Info"
    6. font.pointSize: navTab.getFontSize()
    7. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by bluestreak; 22nd August 2012 at 00:44.

Similar Threads

  1. Replies: 1
    Last Post: 21st March 2012, 13:44
  2. Replies: 0
    Last Post: 17th October 2011, 13:07
  3. Replies: 0
    Last Post: 24th September 2010, 05:37
  4. Propagate mouse events 'physically' rather than 'logically'
    By sebastian.f in forum Qt Programming
    Replies: 5
    Last Post: 14th May 2009, 19:46
  5. How to propagate from one class to another
    By mahe2310 in forum Qt Programming
    Replies: 15
    Last Post: 20th March 2006, 01:27

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.