DialogButtonBox.qml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.Material
  8. import QtQuick.Controls.Material.impl
  9. T.DialogButtonBox {
  10. id: control
  11. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  12. implicitContentWidth + leftPadding + rightPadding)
  13. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  14. implicitContentHeight + topPadding + bottomPadding)
  15. spacing: 8
  16. padding: 8
  17. verticalPadding: 2
  18. alignment: Qt.AlignRight
  19. buttonLayout: T.DialogButtonBox.AndroidLayout
  20. Material.foreground: Material.accent
  21. Material.roundedScale: Material.ExtraLargeScale
  22. delegate: Button { flat: true }
  23. contentItem: ListView {
  24. implicitWidth: contentWidth
  25. model: control.contentModel
  26. spacing: control.spacing
  27. orientation: ListView.Horizontal
  28. boundsBehavior: Flickable.StopAtBounds
  29. snapMode: ListView.SnapToItem
  30. }
  31. background: PaddedRectangle {
  32. implicitHeight: control.Material.dialogButtonBoxHeight
  33. radius: control.Material.roundedScale
  34. color: control.Material.dialogColor
  35. // Rounded corners should be only at the top or at the bottom
  36. topPadding: control.position === T.DialogButtonBox.Footer ? -radius : 0
  37. bottomPadding: control.position === T.DialogButtonBox.Header ? -radius : 0
  38. clip: true
  39. }
  40. }