kernel/qkeymapper.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42 -
43#include "qguiapplication.h" -
44 -
45#include <private/qobject_p.h> -
46#include "qkeymapper_p.h" -
47 -
48QT_BEGIN_NAMESPACE -
49 -
50/*! -
51 \class QKeyMapper -
52 \since 4.2 -
53 \internal -
54 -
55 \sa QObject -
56*/ -
57 -
58/*! -
59 Constructs a new key mapper. -
60*/ -
61QKeyMapper::QKeyMapper() -
62 : QObject(*new QKeyMapperPrivate, 0) -
63{ -
64}
never executed: }
0
65 -
66/*! -
67 Destroys the key mapper. -
68*/ -
69QKeyMapper::~QKeyMapper() -
70{ -
71} -
72 -
73QList<int> QKeyMapper::possibleKeys(QKeyEvent *e) -
74{ -
75 QList<int> result;
executed (the execution status of this line is deduced): QList<int> result;
-
76 -
77 if (!e->nativeScanCode()) {
partially evaluated: !e->nativeScanCode()
TRUEFALSE
yes
Evaluation Count:236
no
Evaluation Count:0
0-236
78 if (e->key() && (e->key() != Qt::Key_unknown))
evaluated: e->key()
TRUEFALSE
yes
Evaluation Count:232
yes
Evaluation Count:4
partially evaluated: (e->key() != Qt::Key_unknown)
TRUEFALSE
yes
Evaluation Count:232
no
Evaluation Count:0
0-232
79 result << int(e->key() + e->modifiers());
executed: result << int(e->key() + e->modifiers());
Execution Count:232
232
80 else if (!e->text().isEmpty())
partially evaluated: !e->text().isEmpty()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
81 result << int(e->text().at(0).unicode() + e->modifiers());
executed: result << int(e->text().at(0).unicode() + e->modifiers());
Execution Count:4
4
82 return result;
executed: return result;
Execution Count:236
236
83 } -
84 -
85 return instance()->d_func()->possibleKeys(e);
never executed: return instance()->d_func()->possibleKeys(e);
0
86} -
87 -
88extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // in qapplication_*.cpp -
89void QKeyMapper::changeKeyboard() -
90{ -
91 instance()->d_func()->clearMappings();
never executed (the execution status of this line is deduced): instance()->d_func()->clearMappings();
-
92 -
93 // ## TODO: Support KeyboardLayoutChange on QPA -
94#if 0 -
95 // inform all toplevel widgets of the change -
96 QEvent e(QEvent::KeyboardLayoutChange); -
97 QWidgetList list = QApplication::topLevelWidgets(); -
98 for (int i = 0; i < list.size(); ++i) { -
99 QWidget *w = list.at(i); -
100 qt_sendSpontaneousEvent(w, &e); -
101 } -
102#endif -
103}
never executed: }
0
104 -
105Q_GLOBAL_STATIC(QKeyMapper, keymapper)
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
0
106/*! -
107 Returns the pointer to the single instance of QKeyMapper in the application. -
108 If none yet exists, the function ensures that one is created. -
109*/ -
110QKeyMapper *QKeyMapper::instance() -
111{ -
112 return keymapper();
never executed: return keymapper();
0
113} -
114 -
115QKeyMapperPrivate *qt_keymapper_private() -
116{ -
117 return QKeyMapper::instance()->d_func();
never executed: return QKeyMapper::instance()->d_func();
0
118} -
119 -
120QT_END_NAMESPACE -
121 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial