1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "QDS_TextEdit.h"
28 \brief Datum with control corresponding to the text edit.
30 User can enter parameter value in multi line editor.
36 Create combobox datum object with datum identifier \a id
37 and parent widget \a parent.
39 Parameter \a flags defines behaviour of datum and set of created
40 subwidgets. Default value of this parameter is QDS::All.
42 Parameter \a comp specifies the component name which will be used
43 when searching the dictionary item.
45 \param id datum identifier
46 \param parent parent widget
47 \param flags datum flags
50 QDS_TextEdit::QDS_TextEdit( const QString& id, QWidget* parent, const int flags, const QString& comp )
51 : QDS_Datum( id, parent, flags, comp )
58 QDS_TextEdit::~QDS_TextEdit()
63 \brief Get string value from datum.
64 \return datum string value
66 QString QDS_TextEdit::getString() const
70 res = textEdit()->toPlainText();
75 \brief Set string value to datum.
76 \param txt new datum string value
78 void QDS_TextEdit::setString( const QString& txt )
81 textEdit()->setText( txt );
85 \brief Get text edit widget.
86 \return internaltext edit widget
88 QTextEdit* QDS_TextEdit::textEdit() const
90 return ::qobject_cast<QTextEdit*>( controlWidget() );
94 \brief Create text edit widget as control subwidget.
95 \param parent parent widget
96 \return created text edit widget
98 QWidget* QDS_TextEdit::createControl( QWidget* parent )
100 QTextEdit* te = new QTextEdit( parent );
101 connect( te, SIGNAL( textChanged() ), this, SLOT( onTextChanged() ) );
106 \brief Called when text is changed by the user.
108 Notify about text changing in text edit.
110 void QDS_TextEdit::onTextChanged()
116 QString str = getString();
119 emit paramChanged( str );
123 \fn void QDS_TextEdit::returnPressed();
124 \brief The signal is emitted when user presses \c Enter key in the text edit.