GroupBox.qml 1.4 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.Templates as T
  6. import QtQuick.Controls.Universal
  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: 12
  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. elide: Text.ElideRight
  23. verticalAlignment: Text.AlignVCenter
  24. opacity: enabled ? 1.0 : 0.2
  25. color: control.Universal.foreground
  26. }
  27. background: Rectangle {
  28. y: control.topPadding - control.bottomPadding
  29. width: parent.width
  30. height: parent.height - control.topPadding + control.bottomPadding
  31. color: "transparent"
  32. border.color: control.Universal.chromeDisabledLowColor
  33. }
  34. }