main.qml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import QtQuick 2.12
  2. import QtQuick.Window 2.12
  3. import QtQuick.Controls 2.12
  4. import qtprotobuf.tutorial 1.0
  5. Window {
  6. visible: true
  7. width: 640
  8. height: 480
  9. title: qsTr("QtProtobuf Tutorial")
  10. EchoRequest {
  11. id: request
  12. message: messageInput.text
  13. }
  14. Column {
  15. spacing: 20
  16. Row {
  17. spacing: 20
  18. Text {
  19. anchors.verticalCenter: parent.verticalCenter
  20. text: "Enter request message:"
  21. }
  22. TextField {
  23. id: messageInput
  24. anchors.verticalCenter: parent.verticalCenter
  25. width: 400
  26. onAccepted: {
  27. EchoClientEngine.request(request);
  28. text = ""
  29. }
  30. }
  31. }
  32. Row {
  33. spacing: 20
  34. Text {
  35. anchors.verticalCenter: parent.verticalCenter
  36. text: "Server respond:"
  37. }
  38. Text {
  39. anchors.verticalCenter: parent.verticalCenter
  40. text: EchoClientEngine.response.message
  41. }
  42. }
  43. }
  44. }