1 // Copyright (C) 2007-2023 CEA, EDF, 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, or (at your option) any later version.
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
23 #include "QDS_TextEdit.h"
29 \brief Datum with control corresponding to the text edit.
31 User can enter parameter value in multi line editor.
37 Create combobox datum object with datum identifier \a id
38 and parent widget \a parent.
40 Parameter \a flags defines behaviour of datum and set of created
41 subwidgets. Default value of this parameter is QDS::All.
43 Parameter \a comp specifies the component name which will be used
44 when searching the dictionary item.
46 \param id datum identifier
47 \param parent parent widget
48 \param flags datum flags
51 QDS_TextEdit::QDS_TextEdit( const QString& id, QWidget* parent, const int flags, const QString& comp )
52 : QDS_Datum( id, parent, flags, comp )
59 QDS_TextEdit::~QDS_TextEdit()
64 \brief Get string value from datum.
65 \return datum string value
67 QString QDS_TextEdit::getString() const
71 res = textEdit()->toPlainText();
76 \brief Set string value to datum.
77 \param txt new datum string value
79 void QDS_TextEdit::setString( const QString& txt )
82 textEdit()->setText( txt );
86 \brief Get text edit widget.
87 \return internaltext edit widget
89 QTextEdit* QDS_TextEdit::textEdit() const
91 return ::qobject_cast<QTextEdit*>( controlWidget() );
95 \brief Create text edit widget as control subwidget.
96 \param parent parent widget
97 \return created text edit widget
99 QWidget* QDS_TextEdit::createControl( QWidget* parent )
101 QTextEdit* te = new QTextEdit( parent );
102 connect( te, SIGNAL( textChanged() ), this, SLOT( onTextChanged() ) );
107 \brief Called when text is changed by the user.
109 Notify about text changing in text edit.
111 void QDS_TextEdit::onTextChanged()
117 QString str = getString();
120 emit paramChanged( str );
124 \fn void QDS_TextEdit::returnPressed();
125 \brief The signal is emitted when user presses \c Enter key in the text edit.