FluTextBoxMenu.qml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import QtQuick
  2. import QtQuick.Controls
  3. import FluentUI
  4. FluMenu{
  5. property string cutText : "剪切"
  6. property string copyText : "复制"
  7. property string pasteText : "粘贴"
  8. property string selectAllText : "全选"
  9. property var inputItem
  10. id:menu
  11. focus:false
  12. enableAnimation:false
  13. Connections{
  14. target: inputItem
  15. function onTextChanged() {
  16. menu.close()
  17. }
  18. }
  19. FluMenuItem{
  20. text: cutText
  21. visible: inputItem.selectedText !== "" && !inputItem.readOnly
  22. onClicked: {
  23. inputItem.cut()
  24. }
  25. }
  26. FluMenuItem{
  27. text: copyText
  28. visible: inputItem.selectedText !== ""
  29. onClicked: {
  30. inputItem.copy()
  31. }
  32. }
  33. FluMenuItem{
  34. text: pasteText
  35. visible: inputItem.canPaste
  36. onClicked: {
  37. inputItem.paste()
  38. }
  39. }
  40. FluMenuItem{
  41. text: selectAllText
  42. visible: inputItem.text !== ""
  43. onClicked: {
  44. inputItem.selectAll()
  45. }
  46. }
  47. }