A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQLineEdit</id>
		<title>C++/Qt/QLineEdit - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2B%2B%2FQt%2FQLineEdit"/>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QLineEdit&amp;action=history"/>
		<updated>2026-04-18T22:23:30Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QLineEdit&amp;diff=1148&amp;oldid=prev</id>
		<title> в 14:21, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QLineEdit&amp;diff=1148&amp;oldid=prev"/>
				<updated>2010-05-25T14:21:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:21, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QLineEdit&amp;diff=1149&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://www.cppe.ru/index.php?title=C%2B%2B/Qt/QLineEdit&amp;diff=1149&amp;oldid=prev"/>
				<updated>2010-05-25T10:24:57Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==gui connection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;myclass.h&amp;quot;&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QWidget&amp;gt;&lt;br /&gt;
#include &amp;lt;QVBoxLayout&amp;gt;&lt;br /&gt;
#include &amp;lt;QLabel&amp;gt;&lt;br /&gt;
#include &amp;lt;QLineEdit&amp;gt;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  QWidget widget;&lt;br /&gt;
  QLineEdit *lineEdit = new QLineEdit();&lt;br /&gt;
  QLabel *label = new QLabel();&lt;br /&gt;
  QVBoxLayout *layout = new QVBoxLayout();&lt;br /&gt;
  layout-&amp;gt;addWidget( lineEdit );&lt;br /&gt;
  layout-&amp;gt;addWidget( label );&lt;br /&gt;
  widget.setLayout( layout );&lt;br /&gt;
  MyClass *bridge = new MyClass( &amp;quot;&amp;quot;, &amp;amp;app );&lt;br /&gt;
  QObject::connect(&lt;br /&gt;
    lineEdit, SIGNAL(textChanged(const QString&amp;amp;)),&lt;br /&gt;
    bridge, SLOT(setText(const QString&amp;amp;)) );&lt;br /&gt;
  QObject::connect(&lt;br /&gt;
    bridge, SIGNAL(textChanged(const QString&amp;amp;)),&lt;br /&gt;
    label, SLOT(setText(const QString&amp;amp;)) );&lt;br /&gt;
  widget.show();&lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Chapter01\gui-connection\myclass.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
#include &amp;quot;myclass.h&amp;quot;&lt;br /&gt;
MyClass::MyClass( const QString &amp;amp;text, QObject *parent ) : QObject( parent )&lt;br /&gt;
{&lt;br /&gt;
  m_text = text;&lt;br /&gt;
}&lt;br /&gt;
const QString &amp;amp;MyClass::text() const&lt;br /&gt;
{&lt;br /&gt;
  return m_text;&lt;br /&gt;
}&lt;br /&gt;
void MyClass::setText( const QString &amp;amp;text )&lt;br /&gt;
{&lt;br /&gt;
  if( m_text == text )&lt;br /&gt;
    return;&lt;br /&gt;
  m_text = text;&lt;br /&gt;
  emit textChanged( m_text );&lt;br /&gt;
}&lt;br /&gt;
int MyClass::getLengthOfText() const&lt;br /&gt;
{&lt;br /&gt;
  return m_text.size();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Chapter01\gui-connection\myclass.h&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
#ifndef MYCLASS_H&lt;br /&gt;
#define MYCLASS_H&lt;br /&gt;
#include &amp;lt;QObject&amp;gt;&lt;br /&gt;
#include &amp;lt;QString&amp;gt;&lt;br /&gt;
class MyClass : public QObject&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
  MyClass( const QString &amp;amp;text, QObject *parent = 0 );&lt;br /&gt;
  const QString&amp;amp; text() const;&lt;br /&gt;
  int getLengthOfText() const;&lt;br /&gt;
public slots:&lt;br /&gt;
  void setText( const QString &amp;amp;text );&lt;br /&gt;
signals:&lt;br /&gt;
  void textChanged( const QString&amp;amp; );&lt;br /&gt;
private:&lt;br /&gt;
  QString m_text;&lt;br /&gt;
};&lt;br /&gt;
#endif &lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Install event filter for QLineEdit==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Foundations of Qt Development\Chapter06\eventfilter\main.cpp&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QLineEdit&amp;gt;&lt;br /&gt;
#include &amp;lt;QKeyEvent&amp;gt;&lt;br /&gt;
class KeyboardFilter : public QObject&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  KeyboardFilter( QObject *parent = 0 ) : QObject( parent ) {}&lt;br /&gt;
  &lt;br /&gt;
protected:&lt;br /&gt;
  bool eventFilter( QObject *dist, QEvent *event )&lt;br /&gt;
  {&lt;br /&gt;
    if( event-&amp;gt;type() == QEvent::KeyPress )&lt;br /&gt;
    {&lt;br /&gt;
      QKeyEvent *keyEvent = static_cast&amp;lt;QKeyEvent*&amp;gt;( event );&lt;br /&gt;
      if( QString(&amp;quot;1234567890&amp;quot;).indexOf( keyEvent-&amp;gt;text() ) != -1 )&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  &lt;br /&gt;
  QLineEdit lineEdit;&lt;br /&gt;
  KeyboardFilter filter;&lt;br /&gt;
  &lt;br /&gt;
  lineEdit.installEventFilter( &amp;amp;filter );&lt;br /&gt;
  lineEdit.show();&lt;br /&gt;
  &lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Line editor==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/****************************************************************************&lt;br /&gt;
**&lt;br /&gt;
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;br /&gt;
** All rights reserved.&lt;br /&gt;
** Contact: Nokia Corporation (qt-info@nokia.com)&lt;br /&gt;
**&lt;br /&gt;
** This file is part of the examples of the Qt Toolkit.&lt;br /&gt;
**&lt;br /&gt;
** $QT_BEGIN_LICENSE:LGPL$&lt;br /&gt;
** Commercial Usage&lt;br /&gt;
** Licensees holding valid Qt Commercial licenses may use this file in&lt;br /&gt;
** accordance with the Qt Commercial License Agreement provided with the&lt;br /&gt;
** Software or, alternatively, in accordance with the terms contained in&lt;br /&gt;
** a written agreement between you and Nokia.&lt;br /&gt;
**&lt;br /&gt;
** GNU Lesser General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU Lesser&lt;br /&gt;
** General Public License version 2.1 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.LGPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU Lesser General Public License version 2.1 requirements&lt;br /&gt;
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.&lt;br /&gt;
**&lt;br /&gt;
** In addition, as a special exception, Nokia gives you certain additional&lt;br /&gt;
** rights.  These rights are described in the Nokia Qt LGPL Exception&lt;br /&gt;
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.&lt;br /&gt;
**&lt;br /&gt;
** GNU General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU&lt;br /&gt;
** General Public License version 3.0 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.GPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU General Public License version 3.0 requirements will be&lt;br /&gt;
** met: http://www.gnu.org/copyleft/gpl.html.&lt;br /&gt;
**&lt;br /&gt;
** If you have questions regarding the use of this file, please contact&lt;br /&gt;
** Nokia at qt-info@nokia.com.&lt;br /&gt;
** $QT_END_LICENSE$&lt;br /&gt;
**&lt;br /&gt;
****************************************************************************/&lt;br /&gt;
#ifndef WINDOW_H&lt;br /&gt;
#define WINDOW_H&lt;br /&gt;
#include &amp;lt;QWidget&amp;gt;&lt;br /&gt;
QT_BEGIN_NAMESPACE&lt;br /&gt;
class QComboBox;&lt;br /&gt;
class QLineEdit;&lt;br /&gt;
QT_END_NAMESPACE&lt;br /&gt;
&lt;br /&gt;
class Window : public QWidget&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    Window();&lt;br /&gt;
public slots:&lt;br /&gt;
    void echoChanged(int);&lt;br /&gt;
    void validatorChanged(int);&lt;br /&gt;
    void alignmentChanged(int);&lt;br /&gt;
    void inputMaskChanged(int);&lt;br /&gt;
    void accessChanged(int);&lt;br /&gt;
private:&lt;br /&gt;
    QLineEdit *echoLineEdit;&lt;br /&gt;
    QLineEdit *validatorLineEdit;&lt;br /&gt;
    QLineEdit *alignmentLineEdit;&lt;br /&gt;
    QLineEdit *inputMaskLineEdit;&lt;br /&gt;
    QLineEdit *accessLineEdit;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
#include &amp;quot;window.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Window::Window()&lt;br /&gt;
{&lt;br /&gt;
    QGroupBox *echoGroup = new QGroupBox(tr(&amp;quot;Echo&amp;quot;));&lt;br /&gt;
    QLabel *echoLabel = new QLabel(tr(&amp;quot;Mode:&amp;quot;));&lt;br /&gt;
    QComboBox *echoComboBox = new QComboBox;&lt;br /&gt;
    echoComboBox-&amp;gt;addItem(tr(&amp;quot;Normal&amp;quot;));&lt;br /&gt;
    echoComboBox-&amp;gt;addItem(tr(&amp;quot;Password&amp;quot;));&lt;br /&gt;
    echoComboBox-&amp;gt;addItem(tr(&amp;quot;PasswordEchoOnEdit&amp;quot;));&lt;br /&gt;
    echoComboBox-&amp;gt;addItem(tr(&amp;quot;No Echo&amp;quot;));&lt;br /&gt;
    echoLineEdit = new QLineEdit;&lt;br /&gt;
    echoLineEdit-&amp;gt;setFocus();&lt;br /&gt;
&lt;br /&gt;
    QGroupBox *validatorGroup = new QGroupBox(tr(&amp;quot;Validator&amp;quot;));&lt;br /&gt;
    QLabel *validatorLabel = new QLabel(tr(&amp;quot;Type:&amp;quot;));&lt;br /&gt;
    QComboBox *validatorComboBox = new QComboBox;&lt;br /&gt;
    validatorComboBox-&amp;gt;addItem(tr(&amp;quot;No validator&amp;quot;));&lt;br /&gt;
    validatorComboBox-&amp;gt;addItem(tr(&amp;quot;Integer validator&amp;quot;));&lt;br /&gt;
    validatorComboBox-&amp;gt;addItem(tr(&amp;quot;Double validator&amp;quot;));&lt;br /&gt;
    validatorLineEdit = new QLineEdit;&lt;br /&gt;
&lt;br /&gt;
    QGroupBox *alignmentGroup = new QGroupBox(tr(&amp;quot;Alignment&amp;quot;));&lt;br /&gt;
    QLabel *alignmentLabel = new QLabel(tr(&amp;quot;Type:&amp;quot;));&lt;br /&gt;
    QComboBox *alignmentComboBox = new QComboBox;&lt;br /&gt;
    alignmentComboBox-&amp;gt;addItem(tr(&amp;quot;Left&amp;quot;));&lt;br /&gt;
    alignmentComboBox-&amp;gt;addItem(tr(&amp;quot;Centered&amp;quot;));&lt;br /&gt;
    alignmentComboBox-&amp;gt;addItem(tr(&amp;quot;Right&amp;quot;));&lt;br /&gt;
    alignmentLineEdit = new QLineEdit;&lt;br /&gt;
&lt;br /&gt;
    QGroupBox *inputMaskGroup = new QGroupBox(tr(&amp;quot;Input mask&amp;quot;));&lt;br /&gt;
    QLabel *inputMaskLabel = new QLabel(tr(&amp;quot;Type:&amp;quot;));&lt;br /&gt;
    QComboBox *inputMaskComboBox = new QComboBox;&lt;br /&gt;
    inputMaskComboBox-&amp;gt;addItem(tr(&amp;quot;No mask&amp;quot;));&lt;br /&gt;
    inputMaskComboBox-&amp;gt;addItem(tr(&amp;quot;Phone number&amp;quot;));&lt;br /&gt;
    inputMaskComboBox-&amp;gt;addItem(tr(&amp;quot;ISO date&amp;quot;));&lt;br /&gt;
    inputMaskComboBox-&amp;gt;addItem(tr(&amp;quot;License key&amp;quot;));&lt;br /&gt;
    inputMaskLineEdit = new QLineEdit;&lt;br /&gt;
&lt;br /&gt;
    QGroupBox *accessGroup = new QGroupBox(tr(&amp;quot;Access&amp;quot;));&lt;br /&gt;
    QLabel *accessLabel = new QLabel(tr(&amp;quot;Read-only:&amp;quot;));&lt;br /&gt;
    QComboBox *accessComboBox = new QComboBox;&lt;br /&gt;
    accessComboBox-&amp;gt;addItem(tr(&amp;quot;False&amp;quot;));&lt;br /&gt;
    accessComboBox-&amp;gt;addItem(tr(&amp;quot;True&amp;quot;));&lt;br /&gt;
    accessLineEdit = new QLineEdit;&lt;br /&gt;
&lt;br /&gt;
    connect(echoComboBox, SIGNAL(activated(int)),&lt;br /&gt;
            this, SLOT(echoChanged(int)));&lt;br /&gt;
    connect(validatorComboBox, SIGNAL(activated(int)),&lt;br /&gt;
            this, SLOT(validatorChanged(int)));&lt;br /&gt;
    connect(alignmentComboBox, SIGNAL(activated(int)),&lt;br /&gt;
            this, SLOT(alignmentChanged(int)));&lt;br /&gt;
    connect(inputMaskComboBox, SIGNAL(activated(int)),&lt;br /&gt;
            this, SLOT(inputMaskChanged(int)));&lt;br /&gt;
    connect(accessComboBox, SIGNAL(activated(int)),&lt;br /&gt;
            this, SLOT(accessChanged(int)));&lt;br /&gt;
&lt;br /&gt;
    QGridLayout *echoLayout = new QGridLayout;&lt;br /&gt;
    echoLayout-&amp;gt;addWidget(echoLabel, 0, 0);&lt;br /&gt;
    echoLayout-&amp;gt;addWidget(echoComboBox, 0, 1);&lt;br /&gt;
    echoLayout-&amp;gt;addWidget(echoLineEdit, 1, 0, 1, 2);&lt;br /&gt;
    echoGroup-&amp;gt;setLayout(echoLayout);&lt;br /&gt;
&lt;br /&gt;
    QGridLayout *validatorLayout = new QGridLayout;&lt;br /&gt;
    validatorLayout-&amp;gt;addWidget(validatorLabel, 0, 0);&lt;br /&gt;
    validatorLayout-&amp;gt;addWidget(validatorComboBox, 0, 1);&lt;br /&gt;
    validatorLayout-&amp;gt;addWidget(validatorLineEdit, 1, 0, 1, 2);&lt;br /&gt;
    validatorGroup-&amp;gt;setLayout(validatorLayout);&lt;br /&gt;
    QGridLayout *alignmentLayout = new QGridLayout;&lt;br /&gt;
    alignmentLayout-&amp;gt;addWidget(alignmentLabel, 0, 0);&lt;br /&gt;
    alignmentLayout-&amp;gt;addWidget(alignmentComboBox, 0, 1);&lt;br /&gt;
    alignmentLayout-&amp;gt;addWidget(alignmentLineEdit, 1, 0, 1, 2);&lt;br /&gt;
    alignmentGroup-&amp;gt; setLayout(alignmentLayout);&lt;br /&gt;
    QGridLayout *inputMaskLayout = new QGridLayout;&lt;br /&gt;
    inputMaskLayout-&amp;gt;addWidget(inputMaskLabel, 0, 0);&lt;br /&gt;
    inputMaskLayout-&amp;gt;addWidget(inputMaskComboBox, 0, 1);&lt;br /&gt;
    inputMaskLayout-&amp;gt;addWidget(inputMaskLineEdit, 1, 0, 1, 2);&lt;br /&gt;
    inputMaskGroup-&amp;gt;setLayout(inputMaskLayout);&lt;br /&gt;
    QGridLayout *accessLayout = new QGridLayout;&lt;br /&gt;
    accessLayout-&amp;gt;addWidget(accessLabel, 0, 0);&lt;br /&gt;
    accessLayout-&amp;gt;addWidget(accessComboBox, 0, 1);&lt;br /&gt;
    accessLayout-&amp;gt;addWidget(accessLineEdit, 1, 0, 1, 2);&lt;br /&gt;
    accessGroup-&amp;gt;setLayout(accessLayout);&lt;br /&gt;
&lt;br /&gt;
    QGridLayout *layout = new QGridLayout;&lt;br /&gt;
    layout-&amp;gt;addWidget(echoGroup, 0, 0);&lt;br /&gt;
    layout-&amp;gt;addWidget(validatorGroup, 1, 0);&lt;br /&gt;
    layout-&amp;gt;addWidget(alignmentGroup, 2, 0);&lt;br /&gt;
    layout-&amp;gt;addWidget(inputMaskGroup, 0, 1);&lt;br /&gt;
    layout-&amp;gt;addWidget(accessGroup, 1, 1);&lt;br /&gt;
    setLayout(layout);&lt;br /&gt;
    setWindowTitle(tr(&amp;quot;Line Edits&amp;quot;));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::echoChanged(int index)&lt;br /&gt;
{&lt;br /&gt;
    switch (index) {&lt;br /&gt;
    case 0:&lt;br /&gt;
        echoLineEdit-&amp;gt;setEchoMode(QLineEdit::Normal);&lt;br /&gt;
        break;&lt;br /&gt;
    case 1:&lt;br /&gt;
        echoLineEdit-&amp;gt;setEchoMode(QLineEdit::Password);&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
      echoLineEdit-&amp;gt;setEchoMode(QLineEdit::PasswordEchoOnEdit);&lt;br /&gt;
        break;&lt;br /&gt;
    case 3:&lt;br /&gt;
        echoLineEdit-&amp;gt;setEchoMode(QLineEdit::NoEcho);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::validatorChanged(int index)&lt;br /&gt;
{&lt;br /&gt;
    switch (index) {&lt;br /&gt;
    case 0:&lt;br /&gt;
        validatorLineEdit-&amp;gt;setValidator(0);&lt;br /&gt;
        break;&lt;br /&gt;
    case 1:&lt;br /&gt;
        validatorLineEdit-&amp;gt;setValidator(new QIntValidator(&lt;br /&gt;
            validatorLineEdit));&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
        validatorLineEdit-&amp;gt;setValidator(new QDoubleValidator(-999.0,&lt;br /&gt;
            999.0, 2, validatorLineEdit));&lt;br /&gt;
    }&lt;br /&gt;
    validatorLineEdit-&amp;gt;clear();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::alignmentChanged(int index)&lt;br /&gt;
{&lt;br /&gt;
    switch (index) {&lt;br /&gt;
    case 0:&lt;br /&gt;
        alignmentLineEdit-&amp;gt;setAlignment(Qt::AlignLeft);&lt;br /&gt;
        break;&lt;br /&gt;
    case 1:&lt;br /&gt;
        alignmentLineEdit-&amp;gt;setAlignment(Qt::AlignCenter);&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
      alignmentLineEdit-&amp;gt;setAlignment(Qt::AlignRight);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::inputMaskChanged(int index)&lt;br /&gt;
{&lt;br /&gt;
    switch (index) {&lt;br /&gt;
    case 0:&lt;br /&gt;
        inputMaskLineEdit-&amp;gt;setInputMask(&amp;quot;&amp;quot;);&lt;br /&gt;
        break;&lt;br /&gt;
    case 1:&lt;br /&gt;
        inputMaskLineEdit-&amp;gt;setInputMask(&amp;quot;+99 99 99 99 99;_&amp;quot;);&lt;br /&gt;
        break;&lt;br /&gt;
    case 2:&lt;br /&gt;
        inputMaskLineEdit-&amp;gt;setInputMask(&amp;quot;0000-00-00&amp;quot;);&lt;br /&gt;
        inputMaskLineEdit-&amp;gt;setText(&amp;quot;00000000&amp;quot;);&lt;br /&gt;
        inputMaskLineEdit-&amp;gt;setCursorPosition(0);&lt;br /&gt;
        break;&lt;br /&gt;
    case 3:&lt;br /&gt;
        inputMaskLineEdit-&amp;gt;setInputMask(&amp;quot;&amp;gt;AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Window::accessChanged(int index)&lt;br /&gt;
{&lt;br /&gt;
    switch (index) {&lt;br /&gt;
    case 0:&lt;br /&gt;
        accessLineEdit-&amp;gt;setReadOnly(false);&lt;br /&gt;
        break;&lt;br /&gt;
    case 1:&lt;br /&gt;
        accessLineEdit-&amp;gt;setReadOnly(true);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;quot;window.h&amp;quot;&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc, argv);&lt;br /&gt;
    Window window;&lt;br /&gt;
    window.show();&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Link QLabel and QLineEdit==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/****************************************************************************&lt;br /&gt;
**&lt;br /&gt;
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).&lt;br /&gt;
** All rights reserved.&lt;br /&gt;
** Contact: Nokia Corporation (qt-info@nokia.com)&lt;br /&gt;
**&lt;br /&gt;
** This file is part of the documentation of the Qt Toolkit.&lt;br /&gt;
**&lt;br /&gt;
** $QT_BEGIN_LICENSE:LGPL$&lt;br /&gt;
** Commercial Usage&lt;br /&gt;
** Licensees holding valid Qt Commercial licenses may use this file in&lt;br /&gt;
** accordance with the Qt Commercial License Agreement provided with the&lt;br /&gt;
** Software or, alternatively, in accordance with the terms contained in&lt;br /&gt;
** a written agreement between you and Nokia.&lt;br /&gt;
**&lt;br /&gt;
** GNU Lesser General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU Lesser&lt;br /&gt;
** General Public License version 2.1 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.LGPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU Lesser General Public License version 2.1 requirements&lt;br /&gt;
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.&lt;br /&gt;
**&lt;br /&gt;
** In addition, as a special exception, Nokia gives you certain additional&lt;br /&gt;
** rights.  These rights are described in the Nokia Qt LGPL Exception&lt;br /&gt;
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.&lt;br /&gt;
**&lt;br /&gt;
** GNU General Public License Usage&lt;br /&gt;
** Alternatively, this file may be used under the terms of the GNU&lt;br /&gt;
** General Public License version 3.0 as published by the Free Software&lt;br /&gt;
** Foundation and appearing in the file LICENSE.GPL included in the&lt;br /&gt;
** packaging of this file.  Please review the following information to&lt;br /&gt;
** ensure the GNU General Public License version 3.0 requirements will be&lt;br /&gt;
** met: http://www.gnu.org/copyleft/gpl.html.&lt;br /&gt;
**&lt;br /&gt;
** If you have questions regarding the use of this file, please contact&lt;br /&gt;
** Nokia at qt-info@nokia.com.&lt;br /&gt;
** $QT_END_LICENSE$&lt;br /&gt;
**&lt;br /&gt;
****************************************************************************/&lt;br /&gt;
#include &amp;lt;QtGui&amp;gt;&lt;br /&gt;
class Updater : public QObject&lt;br /&gt;
{&lt;br /&gt;
    Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
    Updater(QWidget *widget);&lt;br /&gt;
public slots:&lt;br /&gt;
    void adjustSize();&lt;br /&gt;
private:&lt;br /&gt;
    QWidget *widget;&lt;br /&gt;
};&lt;br /&gt;
Updater::Updater(QWidget *widget)&lt;br /&gt;
    : widget(widget)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
void Updater::adjustSize()&lt;br /&gt;
{&lt;br /&gt;
    widget-&amp;gt;adjustSize();&lt;br /&gt;
}&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    QApplication app(argc, argv);&lt;br /&gt;
    QLabel *label = new QLabel(&amp;quot;My label&amp;quot;);&lt;br /&gt;
    QLineEdit *editor = new QLineEdit(&amp;quot;New text&amp;quot;);&lt;br /&gt;
    QWidget window;&lt;br /&gt;
    //Updater updater(&amp;amp;label);&lt;br /&gt;
    QObject::connect(editor, SIGNAL(textChanged(const QString &amp;amp;)),&lt;br /&gt;
                     label, SLOT(setText(const QString &amp;amp;)));&lt;br /&gt;
    //QObject::connect(editor, SIGNAL(textChanged(const QString &amp;amp;)),&lt;br /&gt;
    //                 &amp;amp;updater, SLOT(adjustSize()));&lt;br /&gt;
    //editor.show();&lt;br /&gt;
    //label.show();&lt;br /&gt;
    QVBoxLayout *layout = new QVBoxLayout;&lt;br /&gt;
    layout-&amp;gt;addWidget(label);&lt;br /&gt;
    layout-&amp;gt;addWidget(editor);&lt;br /&gt;
    window.setLayout(layout);&lt;br /&gt;
    window.show();&lt;br /&gt;
    return app.exec();&lt;br /&gt;
}&lt;br /&gt;
#include &amp;quot;main.moc&amp;quot;&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using QLineEdit==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;  &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2006-2007, Johan Thelin&lt;br /&gt;
 * &lt;br /&gt;
 * All rights reserved.&lt;br /&gt;
 * &lt;br /&gt;
 * Redistribution and use in source and binary forms, with or without modification, &lt;br /&gt;
 * are permitted provided that the following conditions are met:&lt;br /&gt;
 * &lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright notice, &lt;br /&gt;
 *       this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright notice,  &lt;br /&gt;
 *       this list of conditions and the following disclaimer in the documentation &lt;br /&gt;
 *       and/or other materials provided with the distribution.&lt;br /&gt;
 *     * Neither the name of APress nor the names of its contributors &lt;br /&gt;
 *       may be used to endorse or promote products derived from this software &lt;br /&gt;
 *       without specific prior written permission.&lt;br /&gt;
 * &lt;br /&gt;
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT&lt;br /&gt;
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR&lt;br /&gt;
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR&lt;br /&gt;
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,&lt;br /&gt;
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,&lt;br /&gt;
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
#include &amp;lt;QApplication&amp;gt;&lt;br /&gt;
#include &amp;lt;QDialog&amp;gt;&lt;br /&gt;
#include &amp;lt;QLineEdit&amp;gt;&lt;br /&gt;
#include &amp;lt;QLabel&amp;gt;&lt;br /&gt;
#include &amp;lt;QGridLayout&amp;gt;&lt;br /&gt;
int main( int argc, char **argv )&lt;br /&gt;
{&lt;br /&gt;
  QApplication app( argc, argv );&lt;br /&gt;
  &lt;br /&gt;
  QDialog dlg;&lt;br /&gt;
  &lt;br /&gt;
  QLabel *fooLabel = new QLabel( &amp;quot;&amp;amp;Foo:&amp;quot; );&lt;br /&gt;
  QLabel *barLabel = new QLabel( &amp;quot;&amp;amp;Bar:&amp;quot; );&lt;br /&gt;
  QLineEdit *fooEdit = new QLineEdit();&lt;br /&gt;
  QLineEdit *barEdit = new QLineEdit();&lt;br /&gt;
  &lt;br /&gt;
  fooLabel-&amp;gt;setBuddy( fooEdit );&lt;br /&gt;
  barLabel-&amp;gt;setBuddy( barEdit );&lt;br /&gt;
  &lt;br /&gt;
  QGridLayout *layout = new QGridLayout( &amp;amp;dlg );&lt;br /&gt;
  layout-&amp;gt;addWidget( fooLabel, 0, 0 );&lt;br /&gt;
  layout-&amp;gt;addWidget( fooEdit, 0, 1 );&lt;br /&gt;
  layout-&amp;gt;addWidget( barLabel, 1, 0 );&lt;br /&gt;
  layout-&amp;gt;addWidget( barEdit, 1, 1 );&lt;br /&gt;
  dlg.show();&lt;br /&gt;
  &lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>