CutAction.qml 1.0 KB

12345678910111213141516171819202122232425
  1. // Copyright (C) 2025 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. T.Action {
  7. text: qsTr("Cut")
  8. icon.name: "edit-cut"
  9. // A few styles use these values, so set them as our default
  10. // so that they can simply use us instead of defining their own actions.
  11. icon.width: 24
  12. icon.height: 24
  13. // This ensures that QIOSMenu::filterFirstResponderActions filters out any
  14. // duplicate actions (at least when QT_NO_SHORTCUT is not defined).
  15. shortcut: StandardKey.Cut
  16. // If the control has no cut property, Qt was built without clipboard support.
  17. enabled: !editor.readOnly && editor.selectedText.length > 0 && editor.hasOwnProperty("cut")
  18. onTriggered: editor.cut()
  19. // Can't be T.Control because otherwise it would fail to assign TextField/TextArea to it,
  20. // and we'd need TextFieldCutAction and TextAreaCutAction.
  21. required property Item editor
  22. }