Qt Quick based coffee brewing control chart.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.qml 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import CustomComponents 1.0
  2. import QtQuick 1.0
  3. Rectangle {
  4. id: root
  5. property real sumy : 0
  6. property real sumxsq : 0
  7. property real sumx : 0
  8. property real sumxy : 0
  9. property int n : 0
  10. width: 720
  11. height: 680
  12. BrewingControlChart {
  13. id: graph
  14. width: 450; height: 600
  15. anchors {right: parent.right; rightMargin: 20; top: parent.top; topMargin: 20}
  16. }
  17. ListView {
  18. spacing: 3
  19. height: 400
  20. width: 100
  21. z: -1
  22. contentHeight: dataViewModel.count * 35
  23. model: ListModel {
  24. id: dataViewModel
  25. }
  26. delegate: Row {
  27. spacing: 3
  28. Rectangle {
  29. width: 30; height: 30
  30. color: dataViewModel.get(index).color
  31. }
  32. Column {
  33. Text {
  34. text: "Strength: " + dataViewModel.get(index).ptds + "% TDS"
  35. }
  36. Text {
  37. text: "Extraction: " + Number(dataViewModel.get(index).extraction * 100).toFixed(2) + "%"
  38. }
  39. }
  40. }
  41. }
  42. Component.onCompleted: {
  43. var quitItem = window.addMenuItem("File", "Quit");
  44. quitItem.shortcut = "Ctrl+Q";
  45. quitItem.triggered.connect(function() {
  46. Qt.quit();
  47. });
  48. var clearItem = window.addMenuItem("Plotting", "Clear Data");
  49. clearItem.triggered.connect(function() {
  50. graph.clear();
  51. dataViewModel.clear();
  52. root.sumy = 0;
  53. root.sumxsq = 0;
  54. root.sumx = 0;
  55. root.sumxy = 0;
  56. root.n = 0;
  57. graph.setFit(0, 0, 0, 0);
  58. });
  59. var showLeastSquares = window.addMenuItem("Plotting", "Least Squares Fit");
  60. showLeastSquares.checkable = true;
  61. showLeastSquares.triggered.connect(function() {
  62. graph.setFitVisible(showLeastSquares.checked);
  63. lsfrow.visible = showLeastSquares.checked;
  64. });
  65. }
  66. }