OptionInput.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 color: value.color
  26. property real margin: 6
  27. implicitHeight: value.implicitHeight + margin*2
  28. implicitWidth: value.implicitWidth + margin*2
  29. Rectangle {
  30. id: rect
  31. anchors.fill: parent
  32. border.width: 1
  33. radius: 2
  34. border.color: enabled ? palette.text : disabledPalette.text
  35. TextInput {
  36. id: value
  37. anchors.fill: parent
  38. anchors.leftMargin: margin
  39. horizontalAlignment: TextEdit.AlignLeft
  40. verticalAlignment: TextEdit.AlignVCenter
  41. renderType: Text.NativeRendering
  42. selectByMouse: true
  43. color: enabled ? palette.text : disabledPalette.text
  44. MouseArea {
  45. anchors.fill: parent
  46. cursorShape: Qt.IBeamCursor
  47. acceptedButtons: Qt.NoButton
  48. }
  49. }
  50. SystemPalette {
  51. id: palette
  52. }
  53. SystemPalette {
  54. id: disabledPalette
  55. colorGroup: SystemPalette.Disabled
  56. }
  57. }
  58. }