Dialog.qml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.Dialog {
  10. id: control
  11. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  12. implicitContentWidth + leftPadding + rightPadding,
  13. implicitHeaderWidth,
  14. implicitFooterWidth)
  15. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  16. implicitContentHeight + topPadding + bottomPadding
  17. + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
  18. + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
  19. padding: 6
  20. background: Rectangle {
  21. color: control.palette.window
  22. border.color: Fusion.highContrast ? control.palette.windowText : control.palette.mid
  23. radius: 2
  24. Rectangle {
  25. z: -1
  26. x: 1; y: 1
  27. width: parent.width - 2
  28. height: parent.height - 2
  29. color: control.palette.shadow
  30. opacity: 0.2
  31. radius: 2
  32. }
  33. }
  34. header: Label {
  35. text: control.title
  36. visible: control.title && parent?.parent === Overlay.overlay
  37. elide: Label.ElideRight
  38. font.bold: true
  39. padding: 6
  40. background: Rectangle {
  41. border.color: Fusion.highContrast ? control.palette.windowText : "transparent"
  42. color: "transparent"
  43. width: parent.width
  44. height: parent.height
  45. topLeftRadius: 2
  46. topRightRadius: 2
  47. Rectangle {
  48. x: 1; y: 1
  49. width: parent.width - 2
  50. height: parent.height - 2
  51. color: control.palette.window
  52. topLeftRadius: 2
  53. topRightRadius: 2
  54. }
  55. }
  56. }
  57. footer: DialogButtonBox {
  58. visible: count > 0
  59. }
  60. T.Overlay.modal: Rectangle {
  61. color: Fusion.topShadow
  62. }
  63. T.Overlay.modeless: Rectangle {
  64. color: Fusion.topShadow
  65. }
  66. }