WizardPageIndicator.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Copyright (c) 2012 Nokia Corporation.
  3. */
  4. import QtQuick 1.1
  5. Rectangle {
  6. property int pageCount
  7. property int activePageIndex: 0
  8. function switchToNextWizardPage() {
  9. markIndicatorDisabled(activePageIndex);
  10. if (activePageIndex < repeater.count - 1) {
  11. activePageIndex++;
  12. markIndicatorEnabled(activePageIndex);
  13. }
  14. }
  15. function switchToPreviousWizardPage() {
  16. markIndicatorDisabled(activePageIndex);
  17. if (activePageIndex > 0) {
  18. activePageIndex--;
  19. markIndicatorEnabled(activePageIndex);
  20. }
  21. }
  22. function reset() {
  23. for(var i = 0; i < repeater.count; i++)
  24. {
  25. markIndicatorDisabled(i);
  26. }
  27. activePageIndex = 0;
  28. markIndicatorEnabled(activePageIndex);
  29. }
  30. function markIndicatorDisabled(index) {
  31. repeater.itemAt(index).color = "gray";
  32. repeater.itemAt(index).opacity = 0.5;
  33. }
  34. function markIndicatorEnabled(index) {
  35. repeater.itemAt(index).color = window.platformInverted ? platformStyle.colorNormalDark : platformStyle.colorNormalLight;
  36. repeater.itemAt(index).opacity = 1;
  37. }
  38. width: mainRow.implicitWidth
  39. height: 90
  40. color: "transparent"
  41. Row {
  42. id: mainRow
  43. anchors.verticalCenter: parent.top
  44. spacing: 12
  45. Repeater {
  46. id: repeater
  47. model: pageCount
  48. Rectangle {
  49. width: 16
  50. height: width
  51. color: "gray"
  52. border.color: "black"
  53. opacity: 0.5
  54. border.width: 1
  55. radius: width/2
  56. }
  57. }
  58. }
  59. }