GroupBox.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (C) 2017 The Qt Company Ltd.
  2. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
  3. // Qt-Security score:significant reason:default
  4. import QtQuick
  5. import QtQuick.Controls.impl
  6. import QtQuick.Templates as T
  7. T.GroupBox {
  8. id: control
  9. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  10. implicitContentWidth + leftPadding + rightPadding,
  11. implicitLabelWidth + leftPadding + rightPadding)
  12. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  13. implicitContentHeight + topPadding + bottomPadding)
  14. spacing: 6
  15. padding: 12
  16. topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
  17. label: Text {
  18. x: control.leftPadding
  19. width: control.availableWidth
  20. text: control.title
  21. font: control.font
  22. color: control.palette.windowText
  23. elide: Text.ElideRight
  24. verticalAlignment: Text.AlignVCenter
  25. }
  26. background: Rectangle {
  27. y: control.topPadding - control.bottomPadding
  28. width: parent.width
  29. height: parent.height - control.topPadding + control.bottomPadding
  30. color: "transparent"
  31. border.color: Qt.styleHints.accessibility.contrastPreference !== Qt.HighContrast ?
  32. control.palette.mid : Color.blend(control.palette.dark, control.palette.base,
  33. enabled ? 0.0 : 0.5)
  34. }
  35. }