OptionInput.qml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2015 Malte Veerman <maldela@halloarsch.de>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. */
  19. import QtQuick 2.4
  20. import QtQuick.Layouts 1.1
  21. FocusScope {
  22. property alias text: value.text
  23. property alias font: value.font
  24. property alias inputMethodHints: value.inputMethodHints
  25. property alias validator: value.validator
  26. property alias color: value.color
  27. property real margin: 6
  28. implicitHeight: value.implicitHeight + margin*2
  29. implicitWidth: value.implicitWidth + margin*2
  30. Rectangle {
  31. id: rect
  32. anchors.fill: parent
  33. border.width: 1
  34. radius: 2
  35. border.color: enabled ? palette.text : disabledPalette.text
  36. TextInput {
  37. id: value
  38. anchors.fill: parent
  39. anchors.leftMargin: margin
  40. horizontalAlignment: TextEdit.AlignLeft
  41. verticalAlignment: TextEdit.AlignVCenter
  42. renderType: Text.NativeRendering
  43. selectByMouse: true
  44. color: enabled ? palette.text : disabledPalette.text
  45. MouseArea {
  46. anchors.fill: parent
  47. cursorShape: Qt.IBeamCursor
  48. acceptedButtons: Qt.NoButton
  49. }
  50. }
  51. SystemPalette {
  52. id: palette
  53. }
  54. SystemPalette {
  55. id: disabledPalette
  56. colorGroup: SystemPalette.Disabled
  57. }
  58. }
  59. }