GroupBox.qml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.impl
  7. import QtQuick.Controls.Fusion
  8. import QtQuick.Controls.Fusion.impl
  9. T.GroupBox {
  10. id: control
  11. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  12. implicitContentWidth + leftPadding + rightPadding,
  13. implicitLabelWidth + leftPadding + rightPadding)
  14. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  15. implicitContentHeight + topPadding + bottomPadding)
  16. spacing: 6
  17. padding: 9
  18. topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
  19. label: Text {
  20. x: control.leftPadding
  21. width: control.availableWidth
  22. text: control.title
  23. font: control.font
  24. color: control.palette.windowText
  25. elide: Text.ElideRight
  26. verticalAlignment: Text.AlignVCenter
  27. }
  28. background: Rectangle {
  29. y: control.topPadding - control.bottomPadding
  30. width: parent.width
  31. height: parent.height - control.topPadding + control.bottomPadding
  32. radius: 2
  33. color: Color.transparent("black", 3 / 255)
  34. border.color: Qt.lighter(Fusion.outline(control.palette), 1.08)
  35. }
  36. }