Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. /*** main.qml ***/
  2. import QtQuick 1.0
  3.  
  4. Rectangle {
  5.  
  6. property variant theme: defaulttheme
  7.  
  8.  
  9. DefaultTheme {
  10. id: defaulttheme
  11. }
  12. DefaultTheme {
  13. id: crazyTheme
  14. fontColor: "yellow"
  15. backgroundColor: "red"
  16. }
  17.  
  18.  
  19. width: 360
  20. height: 360
  21. color: theme.backgroundColor
  22.  
  23. Text {
  24. anchors.centerIn: parent
  25. text: "Hello World"
  26. color: theme.fontColor
  27. }
  28. MouseArea {
  29. anchors.fill: parent
  30. onClicked: {
  31. theme = crazyTheme
  32. }
  33. }
  34. }
  35.  
  36.  
  37. /*** DefaultTheme.qml ***/
  38. import QtQuick 1.0
  39.  
  40. QtObject {
  41. property string backgroundColor: "steelblue"
  42. property string fontColor: "white"
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement