Salome HOME
65fbcb28ec926a0a7a56303c3c717913bcee9819
[modules/gui.git] / src / QDS / QDS_TextEdit.cxx
1 #include "QDS_TextEdit.h"
2
3 #include <qtextedit.h>
4
5 /*!
6   Constructor.
7 */
8 QDS_TextEdit::QDS_TextEdit( const QString& id, QWidget* parent, const int flags, const QString& comp )
9 : QDS_Datum( id, parent, flags, comp )
10 {
11 }
12
13 /*!
14   Destructor.
15 */
16 QDS_TextEdit::~QDS_TextEdit()
17 {
18 }
19
20 /*!
21   Returns string from QTextEdit widget.
22 */
23 QString QDS_TextEdit::getString() const
24 {
25   QString res;
26   if ( textEdit() )
27     res = textEdit()->text();
28   return res;
29 }
30
31 /*!
32   Sets the string into QTextEdit widget.
33 */
34 void QDS_TextEdit::setString( const QString& txt )
35 {
36   if ( textEdit() )
37     textEdit()->setText( txt );
38 }
39
40 /*!
41   Returns pointer to QTextEdit widget.
42 */
43 QTextEdit* QDS_TextEdit::textEdit() const
44 {
45   return ::qt_cast<QTextEdit*>( controlWidget() );
46 }
47
48 /*!
49   Create QTextEdit widget as control subwidget.
50 */
51 QWidget* QDS_TextEdit::createControl( QWidget* parent )
52 {
53   QTextEdit* te = new QTextEdit( parent );
54   connect( te, SIGNAL( textChanged() ), this, SLOT( onTextChanged() ) );
55   return te;
56 }
57
58 /*!
59   Notify about text changing in line edit.
60 */
61 void QDS_TextEdit::onTextChanged()
62 {
63   invalidateCache();
64
65   onParamChanged();
66
67   QString str = getString();
68
69   emit paramChanged();
70   emit paramChanged( str );
71 }