Popup.qml 732 B

12345678910111213141516171819202122232425262728293031
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. //TODO: Не работает
  4. Control {
  5. id: root
  6. padding: 5
  7. property alias opened: _ppc.opened
  8. PopupController {
  9. id: _ppc
  10. target: root.contentItem
  11. }
  12. property bool autoClose: false
  13. background: MouseArea {
  14. id: _bg_mouse
  15. visible: autoClose && (_ppc.opened || _ppc.running)
  16. width: root.leftPadding + root.implicitContentWidth + root.rightPadding
  17. height: root.topPadding + root.implicitContentHeight + root.bottomPadding
  18. onExited: _ppc.opened = false
  19. hoverEnabled: true
  20. }
  21. Binding { target: contentItem; property: "x"; value: _ppc.shift }
  22. Binding { target: contentItem; property: "visible"; value: _ppc.opened || _ppc.running }
  23. }