SettingsForm.qml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import QtQuick 2.0
  2. import QtQuick.Controls 2.2
  3. Page {
  4. id: root
  5. title: qsTr("Settings")
  6. ListModel {
  7. id: settingsModel
  8. ListElement {
  9. name: "serviceUrl"
  10. title: qsTr("nooLite service URL:")
  11. inputHint: Qt.ImhUrlCharactersOnly
  12. }
  13. }
  14. ListView {
  15. model: settingsModel
  16. anchors.fill: parent
  17. anchors.margins: 8
  18. delegate: Item {
  19. id: settingsItem
  20. width: parent.width
  21. height: childrenRect.height
  22. Label {
  23. id: titleLabel
  24. anchors.left: settingsItem.left
  25. anchors.verticalCenter: valueField.verticalCenter
  26. text: model.title
  27. }
  28. TextField {
  29. id: valueField
  30. anchors.right: settingsItem.right
  31. anchors.left: titleLabel.right
  32. anchors.leftMargin: 10
  33. inputMethodHints: model.inputHint
  34. text: settings[model.name]
  35. onTextChanged: {
  36. settings[model.name] = text
  37. }
  38. }
  39. }
  40. }
  41. }