Frame.qml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2024 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.Controls.FluentWinUI3.impl as Impl
  7. import QtQuick.Templates as T
  8. T.Frame {
  9. id: control
  10. implicitWidth: Math.max((background.minimumWidth || implicitBackgroundWidth)
  11. + leftInset + rightInset,
  12. implicitContentWidth + leftPadding + rightPadding)
  13. implicitHeight: Math.max((background.minimumHeight || implicitBackgroundHeight)
  14. + topInset + bottomInset,
  15. implicitContentHeight + topPadding + bottomPadding)
  16. topPadding: __config.topPadding || 0
  17. bottomPadding: __config.bottomPadding || 0
  18. leftPadding: __config.leftPadding || 0
  19. rightPadding: __config.rightPadding || 0
  20. topInset: -__config.topInset || 0
  21. bottomInset: -__config.bottomInset || 0
  22. leftInset: -__config.leftInset || 0
  23. rightInset: -__config.rightInset || 0
  24. readonly property string __currentState: !control.enabled ? "disabled" : "normal";
  25. readonly property var __config: Config.controls.frame[__currentState] || {}
  26. background: Rectangle {
  27. implicitWidth: control.__config.background.width
  28. implicitHeight: control.__config.background.height
  29. color: "transparent"
  30. border.color: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast ? control.palette.text : "transparent"
  31. radius: 4
  32. Impl.StyleImage {
  33. width: parent.width
  34. height: parent.height
  35. imageConfig: control.__config.background
  36. }
  37. }
  38. }