summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/code/src_gui_kernel_qshortcut.cpp
blob: d67aea12880667eeaed997ed8ada5230b892ae0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [0]
shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")),
                         parent);
//! [0]


//! [1]
setKey(0);                  // no signal emitted
setKey(QKeySequence());     // no signal emitted
setKey(0x3b1);              // Greek letter alpha
setKey(Qt::Key_D);              // 'd', e.g. to delete
setKey('q');                // 'q', e.g. to quit
setKey(Qt::CTRL | Qt::Key_P);       // Ctrl+P, e.g. to print document
setKey("Ctrl+P");           // Ctrl+P, e.g. to print document
//! [1]