BenchmarkView.qml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import ru.ded.beerlog 1.0
  4. Page {
  5. title: qsTr("Benchmark")
  6. Column {
  7. anchors.fill: parent
  8. anchors.margins: 10
  9. ItemDelegate {
  10. width: parent.width
  11. text: qsTr("Items count")
  12. TextField {
  13. id: itemsCountField
  14. anchors.right: parent.right
  15. validator: IntValidator {
  16. bottom: 0
  17. top: 100000
  18. }
  19. height: parent.height
  20. inputMethodHints: Qt.ImhPreferNumbers
  21. }
  22. }
  23. ItemDelegate {
  24. width: parent.width
  25. text: qsTr("Submit time")
  26. Label {
  27. anchors.verticalCenter: parent.verticalCenter
  28. anchors.right: parent.right
  29. text: benchmark.submitTime
  30. }
  31. }
  32. ItemDelegate {
  33. width: parent.width
  34. text: qsTr("Receive time")
  35. Label {
  36. anchors.verticalCenter: parent.verticalCenter
  37. anchors.right: parent.right
  38. text: benchmark.receiveTime
  39. }
  40. }
  41. ItemDelegate {
  42. width: parent.width
  43. text: qsTr("Remove time")
  44. Label {
  45. anchors.verticalCenter: parent.verticalCenter
  46. anchors.right: parent.right
  47. text: benchmark.removeTime
  48. }
  49. }
  50. ItemDelegate {
  51. id: startButton
  52. width: parent.width
  53. text: qsTr("Start benchmark")
  54. enabled: !benchmark.inProgress
  55. onClicked: benchmark.startBenchmark()
  56. states: State {
  57. when: benchmark.inProgress
  58. PropertyChanges {
  59. target: startButton
  60. text: qsTr("In progress")
  61. }
  62. }
  63. }
  64. }
  65. BenchmarkViewModel {
  66. id: benchmark
  67. itemsCount: Number(itemsCountField.text)
  68. }
  69. }