1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
<title>Qt 4.6: myinputpanel.cpp Example File (tools/inputpanel/myinputpanel.cpp)</title>
7
<link href="classic.css" rel="stylesheet" type="text/css" />
10
<table border="0" cellpadding="0" cellspacing="0" width="100%">
12
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
13
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
14
</tr></table><h1 class="title">myinputpanel.cpp Example File<br /><span class="small-subtitle">tools/inputpanel/myinputpanel.cpp</span>
16
<pre><span class="comment"> /****************************************************************************
18
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
19
** All rights reserved.
20
** Contact: Nokia Corporation (qt-info@nokia.com)
22
** This file is part of the examples of the Qt Toolkit.
24
** $QT_BEGIN_LICENSE:LGPL$
25
** No Commercial Usage
26
** This file contains pre-release code and may not be distributed.
27
** You may use this file in accordance with the terms and conditions
28
** contained in the Technology Preview License Agreement accompanying
31
** GNU Lesser General Public License Usage
32
** Alternatively, this file may be used under the terms of the GNU Lesser
33
** General Public License version 2.1 as published by the Free Software
34
** Foundation and appearing in the file LICENSE.LGPL included in the
35
** packaging of this file. Please review the following information to
36
** ensure the GNU Lesser General Public License version 2.1 requirements
37
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
39
** In addition, as a special exception, Nokia gives you certain additional
40
** rights. These rights are described in the Nokia Qt LGPL Exception
41
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
43
** If you have questions regarding the use of this file, please contact
44
** Nokia at qt-info@nokia.com.
55
****************************************************************************/</span>
57
#include "myinputpanel.h"
60
MyInputPanel::MyInputPanel()
61
: QWidget(0, Qt::Tool | Qt::WindowStaysOnTopHint),
66
connect(qApp, SIGNAL(focusChanged(QWidget *, QWidget *)),
67
this, SLOT(saveFocusWidget(QWidget *, QWidget *)));
69
signalMapper.setMapping(form.panelButton_1, form.panelButton_1);
70
signalMapper.setMapping(form.panelButton_2, form.panelButton_2);
71
signalMapper.setMapping(form.panelButton_3, form.panelButton_3);
72
signalMapper.setMapping(form.panelButton_4, form.panelButton_4);
73
signalMapper.setMapping(form.panelButton_5, form.panelButton_5);
74
signalMapper.setMapping(form.panelButton_6, form.panelButton_6);
75
signalMapper.setMapping(form.panelButton_7, form.panelButton_7);
76
signalMapper.setMapping(form.panelButton_8, form.panelButton_8);
77
signalMapper.setMapping(form.panelButton_9, form.panelButton_9);
78
signalMapper.setMapping(form.panelButton_star, form.panelButton_star);
79
signalMapper.setMapping(form.panelButton_0, form.panelButton_0);
80
signalMapper.setMapping(form.panelButton_hash, form.panelButton_hash);
82
connect(form.panelButton_1, SIGNAL(clicked()),
83
&signalMapper, SLOT(map()));
84
connect(form.panelButton_2, SIGNAL(clicked()),
85
&signalMapper, SLOT(map()));
86
connect(form.panelButton_3, SIGNAL(clicked()),
87
&signalMapper, SLOT(map()));
88
connect(form.panelButton_4, SIGNAL(clicked()),
89
&signalMapper, SLOT(map()));
90
connect(form.panelButton_5, SIGNAL(clicked()),
91
&signalMapper, SLOT(map()));
92
connect(form.panelButton_6, SIGNAL(clicked()),
93
&signalMapper, SLOT(map()));
94
connect(form.panelButton_7, SIGNAL(clicked()),
95
&signalMapper, SLOT(map()));
96
connect(form.panelButton_8, SIGNAL(clicked()),
97
&signalMapper, SLOT(map()));
98
connect(form.panelButton_9, SIGNAL(clicked()),
99
&signalMapper, SLOT(map()));
100
connect(form.panelButton_star, SIGNAL(clicked()),
101
&signalMapper, SLOT(map()));
102
connect(form.panelButton_0, SIGNAL(clicked()),
103
&signalMapper, SLOT(map()));
104
connect(form.panelButton_hash, SIGNAL(clicked()),
105
&signalMapper, SLOT(map()));
107
connect(&signalMapper, SIGNAL(mapped(QWidget *)),
108
this, SLOT(buttonClicked(QWidget *)));
112
bool MyInputPanel::event(QEvent *e)
114
switch (e->type()) {
115
case QEvent::WindowActivate:
116
if (lastFocusedWidget)
117
lastFocusedWidget->activateWindow();
123
return QWidget::event(e);
127
void MyInputPanel::saveFocusWidget(QWidget * <span class="comment">/*oldFocus*/</span>, QWidget *newFocus)
129
if (newFocus != 0 && !this->isAncestorOf(newFocus)) {
130
lastFocusedWidget = newFocus;
136
void MyInputPanel::buttonClicked(QWidget *w)
138
QChar chr = qvariant_cast<QChar>(w->property("buttonValue"));
139
emit characterGenerated(chr);
141
<p /><address><hr /><div align="center">
142
<table width="100%" cellspacing="0" border="0"><tr class="address">
143
<td width="40%" align="left">Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
144
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
145
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
146
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>