Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_gui_kernel_qkeysequence.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QKeySequence>
4#include <QMenu>
5#include <QTranslator>
6
7
9
10 struct MainWindow : public QWidget
11 {
12 void wrapper();
13 void open();
14 };
15
16 /* Wrap non-compilable code snippet
17
18 //! [0]
19 QKeySequence(QKeySequence::Print);
20 QKeySequence(tr("Ctrl+P"));
21 QKeySequence(tr("Ctrl+p"));
22 QKeySequence(Qt::CTRL | Qt::Key_P);
23 QKeySequence(Qt::CTRL + Qt::Key_P); // deprecated
24 //! [0]
25
26
27 //! [1]
28 QKeySequence(tr("Ctrl+X, Ctrl+C"));
29 QKeySequence(Qt::CTRL | Qt::Key_X, Qt::CTRL | Qt::Key_C);
30 QKeySequence(Qt::CTRL + Qt::Key_X, Qt::CTRL + Qt::Key_C); // deprecated
31 //! [1]
32
33 */ // Wrap non-compilable code snippet
34
36 {
37 //! [2]
38 QMenu *file = new QMenu(this);
39 file->addAction(tr("&Open..."), QKeySequence(tr("Ctrl+O", "File|Open")),
40 this, &MainWindow::open);
41 //! [2]
42 }
43}