Popup.qml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Imagine
  7. import QtQuick.Controls.Imagine.impl
  8. T.Popup {
  9. id: control
  10. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  11. implicitContentWidth + leftPadding + rightPadding)
  12. implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
  13. implicitContentHeight + topPadding + bottomPadding)
  14. topPadding: background ? background.topPadding : undefined
  15. leftPadding: background ? background.leftPadding : undefined
  16. rightPadding: background ? background.rightPadding : undefined
  17. bottomPadding: background ? background.bottomPadding : undefined
  18. topInset: background ? -background.topInset || 0 : 0
  19. leftInset: background ? -background.leftInset || 0 : 0
  20. rightInset: background ? -background.rightInset || 0 : 0
  21. bottomInset: background ? -background.bottomInset || 0 : 0
  22. background: NinePatchImage {
  23. source: Imagine.url + "popup-background"
  24. NinePatchImageSelector on source {
  25. states: [
  26. {"modal": control.modal},
  27. {"dim": control.dim}
  28. ]
  29. }
  30. }
  31. T.Overlay.modal: NinePatchImage {
  32. source: Imagine.url + "popup-overlay"
  33. NinePatchImageSelector on source {
  34. states: [
  35. {"modal": true}
  36. ]
  37. }
  38. }
  39. T.Overlay.modeless: NinePatchImage {
  40. source: Imagine.url + "popup-overlay"
  41. NinePatchImageSelector on source {
  42. states: [
  43. {"modal": false}
  44. ]
  45. }
  46. }
  47. }