Dialog.qml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. T.Dialog {
  8. id: control
  9. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  10. implicitContentWidth + leftPadding + rightPadding,
  11. implicitHeaderWidth,
  12. implicitFooterWidth)
  13. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  14. implicitContentHeight + topPadding + bottomPadding
  15. + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
  16. + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
  17. padding: 12
  18. background: Rectangle {
  19. color: control.palette.window
  20. border.color: control.palette.dark
  21. }
  22. header: Label {
  23. text: control.title
  24. visible: parent?.parent === Overlay.overlay && control.title
  25. elide: Label.ElideRight
  26. font.bold: true
  27. padding: 12
  28. background: Rectangle {
  29. x: 1; y: 1
  30. width: parent.width - 2
  31. height: parent.height - 1
  32. color: control.palette.window
  33. }
  34. }
  35. footer: DialogButtonBox {
  36. visible: count > 0
  37. }
  38. T.Overlay.modal: Rectangle {
  39. color: Color.transparent(control.palette.shadow, 0.5)
  40. }
  41. T.Overlay.modeless: Rectangle {
  42. color: Color.transparent(control.palette.shadow, 0.12)
  43. }
  44. }