Message.qml 789 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import QtQuick 2.0
  2. import "components"
  3. //TODO: делать многострочными слишком большие сообщения
  4. Rectangle {
  5. id: root
  6. width: _text.width + 30
  7. height: _text.height + 10
  8. radius: 5
  9. property string text: ""
  10. property string details: ""
  11. property bool isError: false
  12. signal closed()
  13. color: isError? "#E37575" : "#262626"
  14. DText {
  15. id: _text
  16. anchors.centerIn: parent
  17. property bool showDetails: false
  18. text: showDetails? root.details : root.text
  19. color: root.isError? "#181818" : "#C1C1C1"
  20. font.pixelSize: 16
  21. }
  22. MouseArea {
  23. anchors.fill: parent
  24. hoverEnabled: true
  25. onReleased: if (root.details !== "") _text.showDetails = !_text.showDetails
  26. onExited: if (!_text.showDetails) closed()
  27. }
  28. }