DialogButtonBox.qml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Templates as T
  7. T.DialogButtonBox {
  8. id: control
  9. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  10. implicitContentWidth + leftPadding + rightPadding)
  11. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  12. implicitContentHeight + topPadding + bottomPadding)
  13. spacing: 8
  14. padding: 24
  15. alignment: count === 1 ? Qt.AlignRight : undefined
  16. delegate: Button {
  17. highlighted: DialogButtonBox.buttonRole === DialogButtonBox.AcceptRole || DialogButtonBox.buttonRole === DialogButtonBox.YesRole
  18. }
  19. contentItem: ListView {
  20. implicitWidth: contentWidth
  21. model: control.contentModel
  22. spacing: control.spacing
  23. orientation: ListView.Horizontal
  24. boundsBehavior: Flickable.StopAtBounds
  25. snapMode: ListView.SnapToItem
  26. }
  27. background: Item {
  28. readonly property bool __isHighContrast: Application.styleHints.accessibility.contrastPreference === Qt.HighContrast
  29. implicitHeight: 81
  30. Rectangle {
  31. implicitHeight: parent.__isHighContrast ? 2 : 1
  32. width: parent.width
  33. color: parent.__isHighContrast ? control.palette.text : Application.styleHints.colorScheme === Qt.Light ? "#0F000000" : "#15FFFFFF"
  34. }
  35. Rectangle {
  36. implicitHeight: parent.__isHighContrast ? 79 : 80
  37. x: 1; y: parent.__isHighContrast ? 2 : 1
  38. width: parent.width - 2
  39. height: parent.height - (parent.__isHighContrast ? 3 : 2)
  40. color: control.palette.window
  41. topLeftRadius: 0
  42. bottomLeftRadius: 7
  43. bottomRightRadius: 7
  44. topRightRadius: 0
  45. }
  46. }
  47. }