Tooltip.qml 733 B

123456789101112131415161718192021222324252627282930313233
  1. import QtQuick 2.0
  2. import org.semlanik.cutegit 1.0
  3. Rectangle {
  4. id: root
  5. x: TooltipViewModel.x
  6. y: TooltipViewModel.y
  7. visible: opacity > 0
  8. opacity: TooltipViewModel.visible ? 1.0 : 0.0
  9. width: childrenRect.width + 10
  10. height: 20
  11. color: "#eeeeee"
  12. border.color: "#000000"
  13. border.width: 1
  14. Behavior on opacity {
  15. NumberAnimation {
  16. duration: 200
  17. }
  18. }
  19. Text {
  20. id: textArea
  21. anchors.left: parent.left
  22. anchors.leftMargin: 5
  23. anchors.verticalCenter: parent.verticalCenter
  24. width: textArea.contentWidth
  25. text: TooltipViewModel.text
  26. }
  27. Component.onCompleted: {
  28. TooltipViewModel.viewport = root.parent
  29. }
  30. }