aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/doc/snippets/qtquickcontrols2-action.qml
blob: 4f50ba46d7b3ba31c48bba48d24689e722adf2d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

import QtQuick
import QtQuick.Controls

Item {
    //! [action]
    Action {
        id: copyAction
        text: qsTr("&Copy")
        icon.name: "edit-copy"
        shortcut: StandardKey.Copy
        onTriggered: window.activeFocusItem.copy()
    }
    //! [action]

    //! [toolbutton]
    ToolButton {
        id: toolButton
        action: copyAction
    }
    //! [toolbutton]

    //! [menuitem]
    MenuItem {
        id: menuItem
        action: copyAction
        text: qsTr("&Copy selected Text")
    }
    //! [menuitem]
}