I have been able to get simple properties to work; text, color, source, rotation. Properties that have more levels(?) do not seem to work. I have this working as a base class(?)
Qt Code:
  1. //OnOffImage.qml
  2. import QtQuick 2.0
  3.  
  4. Item {
  5. id: root
  6. width: container.childrenRect.width
  7. height: container.childrenRect.height
  8.  
  9. property alias text: label.text
  10. property alias color: label.color
  11. property alias source: image.source
  12. property alias rotation: image.rotation
  13.  
  14. signal clicked
  15.  
  16. Column {
  17. id: container
  18.  
  19. Text {
  20. id: label
  21. width: image.width
  22. font.bold: true
  23. font.capitalization: Font.AllUppercase
  24. font.pointSize: 24
  25. horizontalAlignment: text.AlignHCenter
  26. }
  27.  
  28. Image {
  29. id: image
  30. fillMode: Image.PreserveAspectFit
  31. }
  32. }
  33.  
  34. MouseArea {
  35. anchors.fill: parent
  36. onClicked: root.clicked()
  37. }
  38.  
  39. states: [
  40. State {
  41. name: "on"
  42. PropertyChanges {target: image; source: "qrc:/files/images/SwitchOn.png"}
  43. },
  44. State {
  45. name: "off"
  46. PropertyChanges {target: image; source: "qrc:/files/images/SwitchOff.png"}
  47. }
  48. ]
  49.  
  50. onClicked: {state == "on" ? state = "off" : state = "on"}
  51. }
To copy to clipboard, switch view to plain text mode 

and am using it like this
Qt Code:
  1. Column {
  2. id: container
  3. spacing: 25
  4. anchors.centerIn: parent
  5.  
  6. OnOffImage {
  7. id: switch1
  8. color: "#ffffff"
  9. text: "Switch 1"
  10. source: "qrc:/files/images/SwitchOff.png"
  11. }
  12. }
To copy to clipboard, switch view to plain text mode 

The aliases I have work fine, and for right now it is not a problem. I have not figured out how to alias the font properties, or more importantly, the state properties. I can set the initial source easy enough, but as it is, clicking will always change it to the hard coded images. I tried this the long way around, by putting the states and onClick with each instance in main.qml, and it worked fine. Well, it worked fine until I tried to save the state of each "button", and they all pile don top of each other, but that is a different problem. If someone could help me understand how to alias the states property, I might be able to figure out the rest.